Closed ryanmcdermott closed 8 years ago
In android/app/build.gradle
android {
...
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
...
multiDexEnabled true
}
Please try adding these lines, may resolve the problem.
Other lines in my android/app/build.gradle
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.14.+"
...
Thanks that worked! Throw that in the README
Good! Will do.
As multiDexEnable true
is not recommended solution, maybe it would be better if changed the dependency from whole compile 'com.google.android.gms:play-services:8.1.0'
to just the subset compile 'com.google.android.gms:play-services-gcm:8.1.0'
. In my settings, it builds when you additionally add compile 'com.android.support:mediarouter-v7:23.0.+'
to build.gradle of this project.
Let me just add an additional piece here; I had the same issue as above and despite a lot of tinkering, I still got the same error.
What worked for me was to delete the android/app/build
folder after changing any of my *.gradle
files.
if any of you has this issue, then do this cd android ./gradlew clean
@herby - what is the issue with using multiDexEnable true
? That is the only way I can get my app to build with this package.
https://facebook.github.io/react-native/docs/android-building-from-source.html --> 4. Making 3rd-party modules use your fork
If you use 3rd-party React Native modules, you need to override their dependencies so that they don't bundle the pre-compiled library. Otherwise you'll get an error while compiling - Error: more than one library with package name 'com.facebook.react'.
Modify your android/app/build.gradle and replace compile project(':react-native-custom-module') with:
compile(project(':react-native-custom-module')) { exclude group: 'com.facebook.react', module: 'react-native' }
After run command
cd android
./gradlew clean
I've been seeing this error:
Have you encountered this? The solutions on StackOverflow haven't seem to resolve it. http://stackoverflow.com/questions/26342444/multiple-dex-files-define-landroid-support-annotation-animres