我是新手
我用:
> Android studio 2.2.3
> Gradle:2.14.1
> Realm-plugin:“classpath”io.realm:realm-gradle-plugin:2.2.1“”
但是当我调用Realm.init(context)时它抛出一个异常;在onCreate of my Activity中.
日志:
12-14 16:40:51.096 3541-3541/? E/AndroIDRuntime: FATAL EXCEPTION: main Process: *.demo, PID: 3541 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/ at io.realm.RealmConfiguration.<clinit>(RealmConfiguration.java:77) at io.realm.RealmConfiguration$Builder.initializeBuilder(RealmConfiguration.java:414) at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:402) at io.realm.Realm.init(Realm.java:188) at *.demo.MainActivity.onCreate(MainActivity.java:21) at androID.app.Activity.performCreate(Activity.java:6237) at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2369) at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at androID.app.ActivityThread.-wrap11(ActivityThread.java) at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at androID.os.Handler.dispatchMessage(Handler.java:102) at androID.os.Looper.loop(Looper.java:148) at androID.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我的课:
import io.realm.Realm;public class MainActivity extends AppCompatActivity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); Realm.init(this); //crashing line }}
Build.gradle模块级别:
apply plugin: 'com.androID.application'apply plugin: 'realm-androID'androID { compileSdkVersion 25 buildToolsversion "25.0.2" defaultConfig { applicationID "*.demo" minSdkVersion 10 targetSdkVersion 25 versionCode 1 versionname "1.0" testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" jackOptions { enabled true } // Enabling multIDex support. multIDexEnabled true } buildTypes { release { MinifyEnabled false //proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' } } compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 }}dependencIEs { compile filetree(dir: 'libs', include: ['*.jar']) androIDTestCompile('com.androID.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.androID.support', module: 'support-annotations' }) compile 'com.androID.support:appcompat-v7:25.1.0' compile 'com.androID.support:design:25.1.0' compile 'com.androID.support:multIDex:1.0.1' compile 'com.github.pwittchen:reactivenetwork:0.7.0' testCompile 'junit:junit:4.12'}
在此先感谢您的帮助.
解决方法:
Jack无法使用Gradle中的transform API.
因此,依赖于transform API的Realm-transformer不能与Jack一起使用.
使用Retrolambda而不是Jack for Java 8功能支持.
总结以上是内存溢出为你收集整理的java – Realm android,似乎没有应用RealmTransformer全部内容,希望文章能够帮你解决java – Realm android,似乎没有应用RealmTransformer所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)