android - How to include a library module multiple times into multiple library modules in the same app project? -
i have project structure as:
- app module
- multiple library modules..
- ...
- common library module (commonlib) consumed library modules above^ (has realm (compile 'io.realm:realm-android:0.82.2') included dependency)
now commonlib included dependency in many modules , when tried run project got multiple dex files found error:
:app:predexdebug up-to-date :app:dexdebug unexpected top-level exception: com.android.dex.dexexception: multiple dex files define lio/realm/defaultrealmmodule; @ com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:596) @ com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:554) @ com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:535) @ com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:171) @ com.android.dx.merge.dexmerger.merge(dexmerger.java:189) @ com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:454) @ com.android.dx.command.dexer.main.runmonodex(main.java:303) @ com.android.dx.command.dexer.main.run(main.java:246) @ com.android.dx.command.dexer.main.main(main.java:215) @ com.android.dx.command.main.main(main.java:106) error:execution failed task ':app:dexdebug'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/home/user/java/jdk1.7.0_75/bin/java'' finished non-zero exit value 2
can me in how can include realm library @ same time include , commonlib module in dependent modules well? thanks
it looks of library projects haven't defined schemas library modules. if not, create file defaultrealmmodule
why conflict in app project.
all libraries should have class looks this:
@realmmodule(library = true, allclasses = true) public class mylibrarymodule() { }
you can read more how include realm in both library , app projects here: https://realm.io/docs/java/latest/#sharing-schemas
Comments
Post a Comment