Hi.
I can't build project with this error.
Error: more than one library with package name 'com.google.android.gms.license'
Yesterday I could build my project with any problem, but suddenly today morning I can't build the project.
The sources are same with yesterday`s. I did not changed a single line.
I couldn't find any clue of package com.google.android.gms.license form google search.
I know that multiple packages using com.google.android.gms can cause dependency problem, so I configured build.gradle so that not conflict each other, and it worked till today morning.
But what iscom.google.android.gms.license ? No search results on google.
How can I fix this? Any Help?
Windows 10
package.json
"dependencies": {
...
"react-native": "0.54.2",
"react-native-admob": "^2.0.0-beta.3",
...
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-admob:processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
gradle.properties googlePlayServicesVersion=11.8.0dependencies {
...
compile(project(':react-native-admob')) {
exclude group: 'com.google.android.gms'
}
compile "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms'
}
compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"
compile(project(':react-native-onesignal')) {
exclude group: 'com.google.android.gms'
}
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
compile(project(':react-native-google-sign-in')) {
exclude group: 'com.google.android.gms'
}
compile "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"
...
}
This is happening because of the latest google play services 12.0.0. I also ran into this issue. So for now I just manually edited build.gradle (node_modules/react-native-admob/android/build.gradle) and changed compile 'com.google.android.gms:play-services-ads:+' to compile 'com.google.android.gms:play-services-ads:11.8.0'
play services 11.8.0 was the last known working version on my react native project. Once I downgraded to 11.8.0, few other dependencies that my project were using also threw the above error..I went ahead and downgraded them all to 11.8.0.
I know this is not the ideal solution but this unblocks me and I can proceed with my app development work.
@vijaykarthik
I added little enhancement to your solution, I could build my project without modifying build.gradle files under /node_modules/.
I updated /android/build.gradle (not /android/app/build.gradle) like below.
def googlePlayServicesVersion = '11.8.0'
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
// react-native-admob
force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
// react-native-maps
force "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"
// react-native-onesignal
force "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
// react-native-google-sign-in
force "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"
}
}
...
}
}
This worked for me.
Thank god for this community.
@nopedev solution worked great.
I bumped build fail issue:
> Task :react-native-admob:compileDebugJavaWithJavac FAILED
/Users/patw/Projects/xxx/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java:20: error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
public class RNAdMobRewardedVideoAdModule extends ReactContextBaseJavaModule implements RewardedVideoAdListener {
^
1 error
And @nopedev's solution can solve this issue too! Thanks!
I've catched this error with the same text as @patw0929.
Thanks @nopedev for the workaround.
In general, you want to force downgraded version of Google Play Services to all com.google.android.gms:play-services-whatever your dependencies use.
In my case it was also react-native-device-info using latest com.google.android.gms:play-services-gcm.
Can you give more detail or example for fix this issue ?
thx
It is actually not a solution. Problem is that this library does not work with newer play-services versions.
For me, even after I set play services to 11.8.0, I still get the error:
error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
It is actually not a solution.
Yeah, it's indeed just a workaround.
For me, even after I set play services to 11.8.0, I still get the error
Have you also forced all other Google Play Services dependencies, that are used by other packages, to 11.8.0?
@nopedev We also had the same issue with the mstore app (mstore.io) but then i found out the issue.
Thanks your great comment.
If possible implement this PR #273 it fixes the issue
For me the @nopedev solution works but the app now crash on startup. Someone has a better solution?
Just point your package to the github repo instead of the version. #273 allows you to simply use the package without any of the modifications stated above.
@SwiftPolar how might one go about doing that? Can you provide an example please.
In package.json:
...
"react-native-admob": "github:sbugert/react-native-admob#master",
...
This is not the best way to do things but I suppose as a workaround its good enough.
This is not the best way to do things but I suppose as a workaround its good enough.
It would be better to point to a specific commit in the master branch (by specifying the last commit's hash after the #) instead of pointing to master branch directly.
@angly-cat Yes that is a safer choice too.
Task :react-native-admob:compileDebugJavaWithJavac FAILED
/Users/patw/Projects/xxx/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java:20: error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
public class RNAdMobRewardedVideoAdModule extends ReactContextBaseJavaModule implements RewardedVideoAdListener {
^
i had the same problem,
i solved like that i installed v2.0.0-beta.2
@sametcilli You mean you still had this problem with the recent 2.0.0-beta.5 version?
I guess, I installed 3 days ago, it has an error, I installed v2.0.0-beta.2
@nopedev solution was working for me for the last few days but now it's crashing on app startup again. Has something changed again with the SDK?
@nopedev
solution worked.
i have resolved issue by updated package
npm i --save react-native-admob@next
Anyone still having this issue?
I still have this issue with nopedev's code in version 2.0.0-beta.5
@Override
public void onRewardedVideoCompleted() {
sendEvent("rewardedVideoDidClose", null);
}
Most helpful comment
@vijaykarthik
I added little enhancement to your solution, I could build my project without modifying
build.gradlefiles under/node_modules/.I updated
/android/build.gradle(not/android/app/build.gradle) like below.This worked for me.