OkBuck 和 Realm 的问题
Issue with OkBuck and Realm
我的构建和 APK 已成功生成,但是当我 运行 应用程序出现错误时,强制关闭应用程序。如果我使用 Gradle 构建相同的依赖项,而不是使用 OkBuck,它 运行 是完美的。 Logcat:
E/AndroidRuntime( 3447): FATAL EXCEPTION: main
E/AndroidRuntime( 3447): Process: mobile.nonaka.com.nonakaapp.ci, PID: 3447
E/AndroidRuntime( 3447): java.lang.ExceptionInInitializerError: RealmTransformer doesn't seem to be applied. Please update the project configuration to use the Realm Gradle plugin. See https://realm.io/news/android-installation-change/
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration.<clinit>(RealmConfiguration.java:77)
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration$Builder.initializeBuilder(RealmConfiguration.java:428)
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:391)
E/AndroidRuntime( 3447): at mobile.nonaka.com.nonakaapp.NONAKAApplication.onCreate(NONAKAApplication.java:44)
E/AndroidRuntime( 3447): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
E/AndroidRuntime( 3447): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
E/AndroidRuntime( 3447): at android.app.ActivityThread.access00(ActivityThread.java:135)
E/AndroidRuntime( 3447): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 3447): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3447): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 3447): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 3447): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3447): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3447): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 3447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 3447): at dalvik.system.NativeStart.main(Native Method)
NONAKAApplication.java 第 44 行有此代码:
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this)
.schemaVersion(1)
.encryptionKey(realmKeyProvider.getRealmKey())
.deleteRealmIfMigrationNeeded()
.build();
https://realm.io/news/android-installation-change 没有帮助。这是我用来生成 Buck 文件的 Gradle 配置:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:2.2.1"
}
}
apply plugin: 'realm-android'
版本:
OkBuck 0.13.1
Realm 2.2.1
Gradle 3.2
Android Gradle Plugin 2.2.3
Android Studio 2.2.3
minSdkVersion 18
targetSdkVersion 25
compileSdkVersion 25
buildToolsVersion '25.0.2'
非常感谢!
那是因为 OkBuck 还不支持 Transform API。
我的构建和 APK 已成功生成,但是当我 运行 应用程序出现错误时,强制关闭应用程序。如果我使用 Gradle 构建相同的依赖项,而不是使用 OkBuck,它 运行 是完美的。 Logcat:
E/AndroidRuntime( 3447): FATAL EXCEPTION: main
E/AndroidRuntime( 3447): Process: mobile.nonaka.com.nonakaapp.ci, PID: 3447
E/AndroidRuntime( 3447): java.lang.ExceptionInInitializerError: RealmTransformer doesn't seem to be applied. Please update the project configuration to use the Realm Gradle plugin. See https://realm.io/news/android-installation-change/
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration.<clinit>(RealmConfiguration.java:77)
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration$Builder.initializeBuilder(RealmConfiguration.java:428)
E/AndroidRuntime( 3447): at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:391)
E/AndroidRuntime( 3447): at mobile.nonaka.com.nonakaapp.NONAKAApplication.onCreate(NONAKAApplication.java:44)
E/AndroidRuntime( 3447): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
E/AndroidRuntime( 3447): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
E/AndroidRuntime( 3447): at android.app.ActivityThread.access00(ActivityThread.java:135)
E/AndroidRuntime( 3447): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 3447): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3447): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 3447): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 3447): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3447): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3447): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 3447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 3447): at dalvik.system.NativeStart.main(Native Method)
NONAKAApplication.java 第 44 行有此代码:
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this)
.schemaVersion(1)
.encryptionKey(realmKeyProvider.getRealmKey())
.deleteRealmIfMigrationNeeded()
.build();
https://realm.io/news/android-installation-change 没有帮助。这是我用来生成 Buck 文件的 Gradle 配置:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:2.2.1"
}
}
apply plugin: 'realm-android'
版本:
OkBuck 0.13.1
Realm 2.2.1
Gradle 3.2
Android Gradle Plugin 2.2.3
Android Studio 2.2.3
minSdkVersion 18
targetSdkVersion 25
compileSdkVersion 25
buildToolsVersion '25.0.2'
非常感谢!
那是因为 OkBuck 还不支持 Transform API。