FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: io/branch/indexing/AppIndexingHelper$1.class
Run "cd android && ./gradlew clean" solved this issue
I'm getting similar problem:
Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
@jaimecorrea @wenbinf Did the suggestion above help? cd android && ./gradlew clean
I think I've seen this error more than once in Android Studio. I always just do Build > Rebuild Project to fix it. That basically just does the equivalent of gradlew clean and then rebuilds.
If you're still having the problem, what version of react-native-branch are you using?
Hi @jdee ,
Using "react-native-branch": "^2.0.0-beta.7" and getting the same error as the OP here even after the trying the posted solution.
UPDATE:
had to remove compile 'io.branch.sdk.android:library:2.+' and then cd android && ./gradlew clean to fix it. I am noticing that this issue can reoccur, but just have clean gradle and it works.
Apparently there were no Android instructions for updating to 2.0.0, only iOS instructions. I've updated them here: https://github.com/BranchMetrics/react-native-branch-deep-linking/blob/master/docs/Release-2.0.0.md#update-your-appbuildgradle-android. Thanks for finding the issue @jnrepo.
Thanks @minhtc that works for me !
In our case (for a temporary fix) we had to change the build.gradle file of every library in node_modules that uses the "com.google.android.gms:*". Here is an example (I have commented out what has been before) of the react-native-google-analytics-bridge library :
apply plugin: 'com.android.library'
// def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "11.8.0"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions {
warning 'InvalidPackage' // prevent error: https://github.com/square/okio/issues/58
}
}
dependencies {
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
compile 'com.facebook.react:react-native:+'
compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
}
I'm getting this every time I run react-native run-android. I fix it by doing cd android && ./gradlew clean, but it's still a massive waste of time. The clean command is not exactly fast and even then I have to re-run react-native run-android from scratch, which takes a while. There should be a more permanent solution than cleaning every time you re-run the build.
Most helpful comment
Run "cd android && ./gradlew clean" solved this issue