Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNEXPECTED TOP-LEVEL EXCEPTION #1721

Closed
chandana1212 opened this issue Nov 4, 2015 · 3 comments
Closed

UNEXPECTED TOP-LEVEL EXCEPTION #1721

chandana1212 opened this issue Nov 4, 2015 · 3 comments
Labels

Comments

@chandana1212
Copy link

Hi,

I have a library project in my application. In the library project I am using Realm as local db and in the main project also I am using realm as local database.

In the library project I have few RealmObject classes. When I created a RealmObject class in the main project while running the code I am getting the below exception.

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\cdara\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\cdara\Documents\SVN\RapidInpectDBSSync\app\build\intermediates\dex\debug --input-list=C:\Users\cdara\Documents\SVN\RapidInpectDBSSync\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lio/realm/DefaultRealmModule;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

Can you please help me in fixing that.

Thank you,
Chandana Dara

@cmelchior
Copy link
Contributor

If you are using Realm in both the library project and the app project you need to define a RealmModule in the library project to avoid conflicting with Realm in the main project. If you do not, you get the conflict error above. You can read more about it here: https://realm.io/docs/java/latest/#sharing-schemas

@chandana1212
Copy link
Author

Thank you

@dalinaum
Copy link
Contributor

dalinaum commented Nov 4, 2015

I'll close this issue. If you encounter further problems, please feel free to reopen this or create a new one.

@dalinaum dalinaum closed this as completed Nov 4, 2015
@dalinaum dalinaum removed the Pending label Nov 4, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants