【发布时间】:2016-07-25 18:59:14
【问题描述】:
我们正在开发一个带有 SDK 的 android 应用程序。 SDK 是应用程序的一个模块。我们仅在 SDK 中使用 Realm(目前)。我添加的关于 Realm 的唯一 gradle 文件是 sdk build.gradle 文件。我在文件顶部添加了 apply plugin: 'realm-android' 和
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.90.1"
}
}
在文件的底部。在我们尝试升级到最新版本(1.1.0)之前,一切都在编译并正常工作。
如果我将版本更改为 1.0.0 或更高版本,则无法编译。这里有一些错误日志: Gradle 控制台:
Note: Processing class TransactionUpdateAPICall
Note: Processing class Address
Note: Creating DefaultRealmModule
PersistentDataManager.java:134: error: no suitable method found for findAllSorted(String,Sort,String,Sort,String,Sort)
objects = query.findAllSorted(sorts.get(0).fieldName,sorts.get(0).dir,sorts.get(1).fieldName,sorts.get(1).dir,sorts.get(2).fieldName,sorts.get(2).dir);
^
method RealmQuery.findAllSorted(String,Sort) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String[],Sort[]) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String,Sort,String,Sort) is not applicable
(actual and formal argument lists differ in length)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
消息窗口还显示来自 Gradle 构建的一些错误消息:
Error:(134, 32) error: no suitable method found for findAllSorted(String,Sort,String,Sort,String,Sort)
method RealmQuery.findAllSorted(String,Sort) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String[],Sort[]) is not applicable
(actual and formal argument lists differ in length)
method RealmQuery.findAllSorted(String,Sort,String,Sort) is not applicable
(actual and formal argument lists differ in length)
Error:Execution failed for task ':sdk:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.*
如果我创建示例应用程序并将 Realm(最新版本)添加到应用程序 gradle 构建文件中,它可以工作。问题在于 SDK 模块中使用的领域。
如果您已经有一些类似的问题并解决了它们,或者知道出了什么问题,请分享。将不胜感激。
提前致谢。
编辑:
解决方法是我必须注释所有使用过的不推荐使用的方法,然后进行编译。编译器将所有 Realm 对象显示为丢失。一旦不推荐使用的方法被注释掉,构建就成功了。
【问题讨论】:
标签: android android-gradle-plugin realm build.gradle