Open Batuhan-Akkaya opened 5 years ago
ReactNative v0.57.4
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
same here...:(
might be similar to an issue i recently encountered. i believe google released an update for com.google.android.gms:play-services-ads and it caused a conflict with the version in android\app\build.gradle
ERROR: `
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED D8: Program type already present: com.google.android.gms.internal.measurement.zzfq
FAILURE: Build failed with an exception.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: `
FIX: changed the version for com.google.android.gms:play-services-ads to my current build version in node_modules\react-native-admob\android\build.gradle
dependencies { compile 'com.facebook.react:react-native:+' compile 'com.google.android.gms:play-services-ads:+' }
to
dependencies { compile 'com.facebook.react:react-native:+' compile 'com.google.android.gms:play-services-ads:17.0.0' }
alternatively i believe it could also work if you update the version in android\app\build.gradle
implementation 'com.google.android.gms:play-services-ads:17.0.0'
to
implementation 'com.google.android.gms:play-services-ads:+'
dependencies { compile 'com.facebook.react:react-native:+' compile 'com.google.android.gms:play-services-ads:17.0.0' }
I tried You proposed Fix And Yes it complied and run.
But On phone it just install amd message popup App has stopped.
My Android Device:
Android 8.1
//==============================================================
My Project Specification:
"react": "16.6.1",
"react-native": "0.57.5",
"react-native-admob": "^2.0.0-beta.5"
//==============================================================
My Project's Android Specs:(MyProject/android/build.gradle)
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
//==============================================================
Admob's Android Specs:(react-native-admob/android/src/build.gradle)
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
}
dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.google.android.gms:play-services-ads:17.0.0'
}
@imran1992 I had same issue as you. Set it to 16.0.0 and the app now loads for me.
@dancork . Thanks Its running but didn't test it by putting ads in it. I just checked for empty project.
I tried You proposed Fix And Yes it complied and run. But On phone it just install amd message popup App has stopped.
You need follow this step:
Update your AndroidManifest.xml
Add your AdMob App ID to your app's AndroidManifest.xml file by adding the
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
</application>
</manifest>
Also this solution worked with 17.1.0 Version Ads
com.google.android.gms:play-services-ads:17.1.0
Hello worked here
**android/gradle.properties**
android.enableAapt2=false <-add
**android/app/build.gradle**
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
....
multiDexEnabled true <- add
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.4' <- add
implementation 'com.google.firebase:firebase-ads:16.0.1' <- add
compile (project(':react-native-admob')) { <- add
exclude group: 'com.google.android.gms'
}
}
My project has not been working since last week. When i removed node_modules and 'npm i' my project crashed. Also i have been facing this issue in my other projects that contains 'admob' since last week. This error: `* What went wrong: Execution failed for task ':app:transformClassesWithDexForRelease'.