react-native-maps: Build process failed - :app:dexDebug FAILED
I init new react-native project and I wanted to include react-native-maps, but it shows me this error.
:app:dexDebug
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)
:app:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I had to add /lib at the end in projectDir in android/settings.gradle
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/android/lib')
I do not know, what am I doing wrong. I am sure, that problem is in somewhere in react-native-maps module, because it was the last, what I installed from npm and then I wanted to build and it shows me error.
Dependencies:
"apsl-react-native-button": "^2.5.0",
"axios": "^0.12.0",
"buffer": "^4.7.0",
"install": "^0.8.1",
"lodash": "^4.13.1",
"npm": "^3.10.5",
"react": "15.2.1",
"react-dom": "^15.2.1",
"react-motion": "^0.4.4",
"react-native": "0.29.0",
"react-native-animatable": "^0.6.1",
"react-native-button": "^1.6.0",
"react-native-camera": "github:lwansbrough/react-native-camera",
"react-native-carousel": "^0.8.0",
"react-native-dismiss-keyboard": "^1.0.0",
"react-native-drawer": "^2.2.6",
"react-native-fit-image": "^1.3.2",
"react-native-gifted-spinner": "0.0.5",
"react-native-keyboard-spacer": "^0.3.0",
"react-native-maps": "^0.7.1",
"react-native-orientation": "^1.17.0",
"react-native-responsive-image": "^1.3.0",
"react-native-router-flux": "^3.31.0",
"react-native-simple-store": "^1.0.1",
"react-native-spring-carousel": "^0.3.4",
"react-native-vector-icons": "^2.0.3",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-form": "^5.3.1",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0"
Thanks for help.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (1 by maintainers)
not sure why but if you go into android and do a ./gradlew clean it solves the issue
yep. i solved by: cd android/ && ./gradlew clean && cd … && react-native run-android
Not working for me, same error… 😕
I try to reproduce my work. Maybe something will help you identify, what am I doing wrong. (not just me like I see). I build on real device Samsung J5 Android 5.1.1.
Everything works well, but this is clean RN0.29. Then
Then I add Google Maps key to AndroidManifest.xml. Point 4 in installation instructions. Then
First false:
This false was fixed like I wrote in first comment with add /lib at the end in projectDir in android/settings.gradle. Then
I fixed this with texas697 idea, so thumbs up for him.
Then
Build process success, but shows blank view and false in console.
I think somebody wrote about this issue, but not for Android, but IOS. I did not test it on IOS.
Thanks for help.
try this on build.gradle
Yes, this worked for me too.
cd android ./gradlew clean
cd … react-native run-android
Any idea why this is?