React-native-image-picker: com.android.dex.DexException: Multiple dex files define La ndroid/support/v7/appcompat/R$anim

Created on 23 Jun 2016  ·  31Comments  ·  Source: react-native-image-picker/react-native-image-picker

Unknown source file : com.android.dex.DexException: Multiple dex files define La
ndroid/support/v7/appcompat/R$anim;

Most helpful comment

I was getting the same error (not sure if it was related to react-native-image-picker) but running cd android && ./gradlew clean fixed the issue for me.

All 31 comments

the same problem, i'm using RN0.28

Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
Unknown source file :   at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file :   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file :   at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file :   at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file :   at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

I can reproduce, but I have no idea how to fix. Everything online indicates it's an issue with the android support library being included twice, but the only dependency that my library declares is for react-native. If anyone knows how to fix this, please send a pull request.

But it happens only if I install this package

发自我的 iPhone

在 2016年6月23日,21:35,Marc Shilling [email protected] 写道:

I can reproduce, but I have no idea how to fix. Everything online indicates it's an issue with the android support library being included twice, but the only dependency that my library declares is for react-native. If anyone knows how to fix this, please send a pull request.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

I realize that...there is an issue with this package...I don't know how to fix it....

I've made it out, i tried to change the build.gradle as the other packages and it works

dependencies {
   classpath 'com.android.tools.build:gradle:1.1.3' => 1.3.1
}
defaultConfig {
  targetSdkVersion 22 => 23
}

@nihgwu Can you submit a pull request?

OK, and thanks for your work, this package is awesome
actually i made several changes, i'll find which one is the key point and then send a PR

I'm still getting this error. I was checking 0.19.6 and updating targetSdkVersion to 23 didn't help.
Went all the way back to 0.19.3 and it seems to be working.

@3vilguy have you tried to clean the build folders first? i've just add the dependencies section i didn't mention before, please remove the build folders both in the package and in the android folder, ( actually i also remove the .gradle folder for clean up)
one of my friend has solved the issue by update this packge

@nihgwu yeah I did remove almost anything from android folder which wasn't in original template. In fact I even tried doing:

react-native init AwesomeProject
cd AwesomeProject

npm install react-native-image-picker@latest --save
rnpm link react-native-image-picker

react-native run-android

And this is blowing up. So pretty much brand new project, nothing added yet, not builded yet...

Any other ideas?

I was getting the same error (not sure if it was related to react-native-image-picker) but running cd android && ./gradlew clean fixed the issue for me.

@villetou thanks for posting that! it fixed it for me :)

@villetou thanks.... Perfect work for me :)

@villetou thanks, really helpful!

@villetou : Oh man, lost an hour on that.... Thanks for this solution! I might have spend 2 on it ^_^

@villetou: Thank you for that tip, solved my issue.

@villetou thinks

oh man @villetou you saved me, thanks

@villetou Thanks!!

@villetou I have to let you know that you are actually super awesome!!!

@villetou Nice, good job!!!

@villetou thanks!!!

@villetou Nice, good job

i'm getting same issue and fix from @villetou is not working for me...

RN version 0.39

@villetou simple but works thank you!!

@villetou thanks

@villetou it doesn't work for me ....in my case guess the module (react-native-firebase-analytics) is related. rn 0.38

@villetou thanks! Saved my day

@villetou thanks

@villetou thanks

For me worked this answer. Problem was in disabled proguard.

Was this page helpful?
0 / 5 - 0 ratings