I've got 2 jar libraries I'm including that both have a copy of gson.jar and because of this when I try to run my project I get an exception saying UNEXPECTED TOP LEVEL EXCEPTION Multiple Dex Files defined. I've found several sources saying to just remove one of the libraries however I can't because I need other items included in both jars. Is there a way to keep both jars in the project and still get it to run
Asked
Active
Viewed 2,126 times
0
-
You need to use `exclude module:` in `build.gradle` – mbmc Aug 19 '14 at 20:00
-
How do I find out which module to exclude? I've tried running ./gradle dependencies in my terminal but it says it's been deprecated. I also tried adding exclude module: 'gson-2.3.jar' but it's still in their when I build the project – user2687482 Aug 19 '14 at 20:57
1 Answers
1
try deleting the classes of the folder bin\dexedLibs of your project maybe this is the place where is generated a copy of the jar

Ivone
- 13
- 4
-
Thank u Scott that did solve my problem to add exclude module. Thank u so much for that link. Instead of exclude module:'gson-2.3.jar' I used exclude module: 'gson' – user2687482 Aug 19 '14 at 22:44
-
Thank you, you inspired me to go to: MyProject folder -> build -> intermediate -> dex-cache -> cache.xml opened this and deleted items of support-v4.jar manually. Then cleaned the project and ran it and it worked :) Thank u – fullmoon Jan 13 '15 at 05:10