3
ライブラリRealmModule
を作成しようとしていますので、私のウェアとモバイルモジュールの間でスキーマを共有できます。io.realm.ClimbingModuleMediatorを見つけることができません
public class Climb extends RealmObject {
private int grade;
private int type;
@Required private Date date;
@PrimaryKey private String id;
// getters and setters
...
}
そして、それはこの構成で使われています:私は、私はこのように同じライブラリモジュール内に配置され、作成した唯一のRealmObject
は、あります。この
@RealmModule(library = true, allClasses = true)
public class ClimbingModule {
}
のようなモジュールを作成してい
をRealmConfiguration config = new RealmConfiguration.Builder(context)
.deleteRealmIfMigrationNeeded()
.modules(new ClimbingModule())
.build();
Realm.setDefaultConfiguration(config);
私は取得していますエラーは次のとおりです。
java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapApplication: io.realm.exceptions.RealmException: Could not find io.realm.ClimbingModuleMediator
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4715)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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)
Caused by: io.realm.exceptions.RealmException: Could not find io.realm.ClimbingModuleMediator
at io.realm.RealmConfiguration.getModuleMediator(RealmConfiguration.java:293)
at io.realm.RealmConfiguration.createSchemaMediator(RealmConfiguration.java:267)
at io.realm.RealmConfiguration.<init>(RealmConfiguration.java:111)
at io.realm.RealmConfiguration.<init>(RealmConfiguration.java:63)
at io.realm.RealmConfiguration$Builder.build(RealmConfiguration.java:649)
at com.example.mysynclibrary.Shared.initRealm(Shared.java:34)
at com.example.grant.wearableclimbtracker.MyApplication.onCreate(MyApplication.java:20)
at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4712)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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)
Caused by: java.lang.ClassNotFoundException: io.realm.ClimbingModuleMediator
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at io.realm.RealmConfiguration.getModuleMediator(RealmConfiguration.java:288)
at io.realm.RealmConfiguration.createSchemaMediator(RealmConfiguration.java:267)
at io.realm.RealmConfiguration.<init>(RealmConfiguration.java:111)
at io.realm.RealmConfiguration.<init>(RealmConfiguration.java:63)
at io.realm.RealmConfiguration$Builder.build(RealmConfiguration.java:649)
at com.example.mysynclibrary.Shared.initRealm(Shared.java:34)
at com.example.grant.wearableclimbtracker.MyApplication.onCreate(MyApplication.java:20)
at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4712)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.realm.ClimbingModuleMediator" on path: DexPathList[[dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-support-annotations-24.0.0_8ed1f58ead6d248c8a4f50bb1897cc60a8d93971-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-stetho-1.3.1_3739d2a1ecc8680bba36444b965da940ae04a19b-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-realm-annotations-1.1.0_6d467512d704956e369a7713fcd76becefc3e018-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-jsr305-2.0.1_fa7c5ea253e798c2471f648fc357192a6a638816-classes.dex", dex file "/data/data/com.example.grant.wearableclimbtracker/files/instant-run/dex/slice-io.realm-realm-android-library-1.1.0_99e6e7dc6894989e0af3ce27b39ee
io.realm.ClimbingModuleMediatorはどこに作成されるのですか?
私はProGuardまたはMultidexを使用していません。これは、このエラーで見つかった唯一の犯人です。
ありがとうございます!
私はビルドをクリーニングし、インスタント実行を無効にし、アプリをアンインストール/再インストールして時計に入れましたが、同じエラーが発生しました。私はステップを逃しました、私はここでこれらの例に従おうとしていますか?[https://github.com/realm/realm-java/tree/master/examples/moduleExample] – grantka
これはうまくいきました。もし 'apply plugin : 'realm-android''これはうまくいくはずです。あなたのapp/wear依存関係は関連しているかもしれません。 – EpicPandaForce
それはそれでした!私は 'apply plugin: 'realm-android''を共有モジュールに移動したときに追加するのを忘れました。ありがとうございました!! – grantka