OS: macOS Sierra 10.12.6
Node: 6.10.2
Yarn: 1.3.2
npm: 3.10.10
Watchman: 4.9.0
Xcode: Not Found
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run react-native info
and edit your issue to include these results under the Environment section?
Thank you for your contributions.
same here.
Yesterday I could build my project, but today morning suddenly it failed.
I did not change my code at all.
Maybe It related to new release of Google Play services 12.0.0
(released at March 20, 2018)
the same happened to me but with cordova, without having made any modification to my code
Environment:
OS: macOS Sierra 10.12.6
Node: 6.10.2
Yarn: 1.3.2
npm: 3.10.10
Watchman: 4.9.0
Xcode: Not Found
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
Is the error coming up for a specific module? In mine I had the react-native-camera library using this in its own build.gradle, (under Gradle Scripts in Android Studio)
dependencies {
....
compile 'com.google.android.gms:play-services-vision:+'
....
}
Which was causing it to use the latest unsupported version, bringing up this issue.
Just change that line to compile 'com.google.android.gms:play-services-vision:11.6.0'
or the most recent compatible version for you.
I suffered the same problem. It's OK last afternoon, but build error this morning.
FAILURE: Build failed with an exception.
Error: more than one library with package name 'com.google.android.gms.license'
My environment as below:
react-native-cli: 2.0.1
react-native: 0.44.3
npm: 5.5.1
OS : Windows 10
This is what you want to look for
Change that +
to 11.6.0
in node_modules/react-native-device-info/android/build.gradle
As a temporary fix of course
There is a relevant issue you can refer to.
I am facing the same issue
* What went wrong:
Execution failed for task ':react-native-mauron85-background-geolocation:processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
Environment:
OS: Linux 4.13
Node: 6.11.4
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.3.0-alpha.2 => 16.3.0-alpha.2
react-native: 0.54.2 => 0.54.2
On the other hand I have a very similar project (it is basically the same one) but with react-native 0.48.4 and in that case it is working fine.
I just fixed by adding the below line in gradle.properties
googlePlayServicesVersion=11.6.0 .
compile 'com.google.android.gms:play-services-vision:11.8.0'
11.8.0 is OK
When I tried this:
I just fixed by adding the below line in gradle.properties
googlePlayServicesVersion=11.6.0 .
I got:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-device-info'.
> Could not resolve all dependencies for configuration ':react-native-device-info:_debugPublishCopy'.
> Could not find com.google.android.gms:play-services-gcm:11.6.0.
Searched in the following locations:
...
And when I tried this:
compile 'com.google.android.gms:play-services-vision:11.8.0'
11.8.0 is OK
I got:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.google.android.gms:play-services-vision:11.8.0.
Searched in the following locations:
...
@justcarthy Yeah, it works.
resource found that matches the given name: attr 'android:keyboardNavigationCluster'. i got this error
@augusto-altman You could try this one.
In my case, I managed to solve it by aligning all version of com.google.firebase in ‘platforms/android/project.properties’ to older version such as below:
cordova.system.library.4=com.google.firebase:firebase-core:11.+
cordova.system.library.5=com.google.firebase:firebase-messaging:11.+
cordova.system.library.6=com.google.firebase:firebase-crash:11.+
cordova.system.library.7=com.google.firebase:firebase-config:11.+
cordova.system.library.8=com.google.android.gms:play-services-location:11.+
cordova.system.library.9=com.google.android.gms:play-services-auth:11.+
cordova.system.library.10=com.google.android.gms:play-services-identity:11.+
The above was changed to: 11.+ from previously: +
Also, any includes, e.g. (cordova-plugin-firebase/android-build.gradle) should also be changed as above. This might be temporary solution until managed to figure out what’s wrong with version 12.0.0 release.
What went wrong:
Execution failed for task ':react-native-google-signin:processReleaseResources'.Error: more than one library with package name 'com.google.android.gms.license'
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILED
I fix the error changing compile 'com.google.android.gms:play-services-auth:+'
to compile 'com.google.android.gms:play-services-auth:11.6.0'
on node_modules/react-native-google-signin/build.gradle
It's works for me.
node_modules/react-native-device-info/android/build.gradle:
dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.google.android.gms:play-services-gcm:11.8.0' // update by me on 20180321
//compile 'com.google.android.gms:play-services-gcm:+'
}
This worked for me. Edit /android/build.gradle
.(not /android/app/build.gradle
)
You need to check what gms modules are required for your project. You can find required gms modules at each build.gradle
file of each react-native plugins which using gms.
In my case I needed to check next 4 plugins. react-native-admob
, react-native-maps
, react-native-onesignal
, react-native-google-sign-in
. The module names can be different by project.
or, You can check the required module names by running command gradlew app:dependencies
.(run in the android directory)
// This is not need to be 11.8.0. Use your required version.
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"
}
}
...
}
}
#PlayServicesGate
how to solve it? help help
@ZKeLin I just got all my com.google.firebase and com.google.android deps from android/app/build.gradle
:
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.google.firebase:firebase-crash:11.0.0'
compile 'com.google.firebase:firebase-analytics:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.android.gms:play-services-base:11.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services-wallet:11.0.0'
...
}
and put them into android/build.gradle
allprojects {
repositories {
...
configurations.all {
// #PlayServicesGate — March, 20 2018
resolutionStrategy {
force 'com.google.firebase:firebase-core:11.0.0'
force 'com.google.firebase:firebase-crash:11.0.0'
force 'com.google.firebase:firebase-analytics:11.0.0'
force 'com.google.firebase:firebase-messaging:11.0.0'
force 'com.google.android.gms:play-services-base:11.0.0'
force 'com.google.android.gms:play-services-maps:11.0.0'
force 'com.google.android.gms:play-services-wallet:11.0.0'
}
}
}
}
Use your own versions from android/app/build.gradle
I can not install ...play-services-*:11.8.0 . why? duo to my android studio is too old?
I have also faced same issue in react-native development.
i just used @isnifer and @nopedev answers..
This worked for me. edit /android/build.gradle
Before Editing
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
if (overrideVersion != null && details.requested.version != overrideVersion) {
println("********************************************************")
println("Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion")
details.useVersion overrideVersion
println("********************************************************")
}
}
}
After
configurations.all {
resolutionStrategy{
force "com.google.android.gms:play-services-ads:11.8.0"
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-location:11.8.0"
eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
if (overrideVersion != null && details.requested.version != overrideVersion) {
println("********************************************************")
println("Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion")
details.useVersion overrideVersion
println("********************************************************")
}
}
}
}
Bleeding edge really bleeding for me now 😿
I have problem too with google signin, i fixed with this. edit \node_modules\react-native-google-signin\android\build.gradle
compile 'com.google.android.gms:play-services-auth:+
change +
to 11.6.0
+1
@nopedev suggestions don't work for me :/
edit
android/build.gradle
work for me
...
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-auth:11.8.0"
}
}
}
}
I had
What went wrong:
Execution failed for task ':react-native-device-info:processReleaseResources'.
Error: more than one library with package name 'com.google.android.gms.license'
and
What went wrong:
Execution failed for task ':react-native-push-notification-info:processReleaseResources'.
Error: more than one library with package name 'com.google.android.gms.license'
and I solved them by changing into node-modules/react-native-device-info/android/build.gradle
compile 'com.google.android.gms:play-services-gcm:11.6.0'
But now I have a more generic
- What went wrong:
Execution failed for task ':app:processReleaseResources'.
Error: more than one library with package name 'com.google.android.gms.license'
How to solve this??
Thx
same issue
Environment:
OS: macOS High Sierra 10.13.4
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.2 => 0.54.2
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-camera:processReleaseResources'.
Error: more than one library with package name 'com.google.android.gms.license'
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I was getting the following error while running my app (react-native run-android)
* What went wrong:
Execution failed for task ':react-native-device-info:processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
I used the @indrawanadjie workaround and it worked for me...
I went to node_modules/react-native-device-info/android/build.gradle
In the line
compile 'com.google.android.gms:play-services-auth:+
change + to 11.6.0
Now this should only be a quick fix...
If anyone is using react-native-camera, go to node-modules/react-native-camera/android and edit build.gradle
change from:
dependencies{
....
compile 'com.google.android.gms:play-services-vision:+
}
to:
dependencies{
....
compile 'com.google.android.gms:play-services-vision:11.8.0
}
as a temporary workaround
Using cordova firebase plugin getting this issue. Any solution on that ????
Try upgrading gradle plugin to 3.0.1, this will help https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
You also may face some issues due to dex limitation, multiDexEnabled true may help
Well this is just great. The whole ecosystem brought down by a "+" in someones dependencies dependencies dependency.
i changes all dependencies to 12.0.0 but firebase is showing an error due to internal dependencies
I needed to change:
compile "com.google.android.gms:play-services-wallet:11.8.0"
in android/app/build.gradle
and
compile 'com.google.android.gms:play-services-analytics:11.8.0'
in node_modules/react-native-google-analytics-bridge/android/build.gradle
and it works now
@AndrejGajdos you are right but its not a solution to change something in node_modules it work in local but not in fresh build
in ionic // add this in platform/build.gradle/
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
configurations.all {
resolutionStrategy {
// Add force (11.4.0 is version you want to use)
force 'com.google.firebase:firebase-messaging:11.4.0'
force 'com.google.firebase:firebase-core:11.4.0'
force 'com.google.android.gms:play-services-gcm:11.4.0'
}
}
}
}
work for me
@jigaryadav correct.
@AndrejGajdos your solution won't work on CI.
Just exclude bad deps from modules in android/app/build.gradle
to use your own versions of deps, for example, here's our config at Tipsi:
dependencies {
...
compile(project(':react-native-firebase-crash-report')) {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-crash'
}
compile(project(':react-native-firebase-analytics')) {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
}
compile(project(':react-native-fcm')) {
exclude group: "com.google.firebase"
}
}
:processDebugResources
FAILED
FAILURE: Build failed with an exception.
.....
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-firebase/richer-build.gradle
cordova.system.library.1=com.google.gms:google-services:+
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.3=com.google.firebase:firebase-core:+
cordova.system.library.4=com.google.firebase:firebase-messaging:+
cordova.system.library.5=com.google.firebase:firebase-crash:+
cordova.system.library.6=com.google.firebase:firebase-config:+
i tried changing cordova.system.library.3=com.google.firebase:firebase-core:+ to cordova.system.library.3=com.google.firebase:firebase-core:11.6.0
Nothing works form me.
cli packages: (C:\Users\ADT-LPT88\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.13.1
ionic (Ionic CLI) : 3.13.1
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.5
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v6.11.3
npm : 3.10.10
OS : Windows 7
Misc:
backend : pro
any ideas?
i also got the same error i used the code snippet
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-vision:10.2.0'
force 'com.android.support:exifinterface:27.+'
}
}
in android/build.gradle
now build succeed but got error like cannot read property Aspect of undefined
every patch is working fine for now but I am stuck in this execution does anybody know which service onesignal use ?
Execution failed for task ':react-native-onesignal:processReleaseResources'
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
Error: more than one library with package name 'com.google.android.gms.license'
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
@Lifesoftware there are so many answers for your error
@isnifer thanks man
@isnifer Which one ??????
Im trying all answers but still it is not working.
@Lifesoftware show full debug info
@Lifesoftware its simple as i am struggling with my project i find out that any dependencies you have used in your project all are using '+' and now its not working anymore so apply specific version to it by doing
in : android/build.gradle
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-gcm:11.8.0"
.... your other dependencies
}
}
this worked for me as I stuck in onesignal but @isnifer help me out and now everything is working fine
getting same error
its a cordova project
i am using this google plugins
cordova-plugin-firebase 0.1.25 "Google Firebase Plugin"
cordova-plugin-geolocation 2.4.3-dev "Geolocation"
cordova-plugin-google-analytics 1.7.4 "Google Universal Analytics Plugin"
cordova-plugin-googleplus 5.1.1 "Google SignIn"
its was running properly.
suddenly it stops working
i tried changing version to 11.0.0 in build.gradle but doesnt work for me
@Lifesoftware
did u got any solution for this ???
@jigaryadav please check im adding all dependancy.
im using firbase plugin.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:24.0.0'
force 'com.google.android.gms:play-services-vision:10.2.0'
force 'com.android.support:exifinterface:27.+'
}
}
@Lifesoftware are you using react-native-firebase
?
@smayur00
Still facing same issue
@jigaryadav
No cordova plugin (cordova-plugin-firebase)
I am also facing same issue , now not able to build apk.
My build.gradle contains,
compile project(':react-native-orientation')
compile project(':react-native-share')
compile(project(':react-native-firebase')) {
transitive = false
}
compile "com.google.firebase:firebase-invites:11.8.0"
compile project(':react-native-google-analytics-bridge')
compile project(':react-native-vector-icons')
compile project(':react-native-send-intent')
compile project(':react-native-onesignal')
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:11.8.0'
compile 'com.google.android.gms:play-services-maps:+'
compile project(':react-native-facebook-account-kit')
compile project(':react-native-code-push')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
Any suggestions please
@Lifesoftware sorry no idea about Cordova's plugin but logic is same i guess u have to find for Cordova
@jigaryadav Can you share your build.gradle file
Many libraries are migrating to new "Gradle Configuration Properties" mechanism. Check your associated libraries to see if they support it.
react-native-maps
supports googlePlayServicesVersion
react-native-device-info
supports googlePlayServicesVersion
.
react-native-firebase
supports firebaseVersion
here @Lifesoftware
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
configurations.all {
resolutionStrategy {
// react-native-onesignal
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-location:11.8.0"
// react-native-google-sign-in
force "com.google.android.gms:play-services-auth:11.8.0"
}
}
}
}
@jigaryadav I use react-native-firebase.
It causes this error.
Do you know which force line is required on 'build.gradle'?
Thanks.
@sarykemmoun See my comment above for react-native-firebase
and firebaseVersion
@sarykemmoun first of all, see Christocracy's comment https://github.com/facebook/react-native/issues/18479#issuecomment-374938507.
Are you sure that react-native-firebase
causes an error? Looks like they have fixed version
@sarykemmoun how to define this variable see here — https://github.com/facebook/react-native/issues/18479#issuecomment-374849967
Everyone listening on this thread should perform the following.
As recommended by the Android Developer Document Gradle Tips & Tricks (See "Configure project-wide properties"), if the hosting application defines the following properties in their root build.gradle
, peer modules (like react-native-maps
, react-native-firebase
, react-native-device-info
, etc) can align its dependencies as requested:
android/build.gradle
buildscript {...}
allprojects {...}
/**
* Project-wide gradle configuration properties for use by all modules
* NOTE: Set your versions here as desired using the existing values defined in your
* android/app/build.gradle
*/
+ext {
+ compileSdkVersion = 26
+ targetSdkVersion = 26
+ buildToolsVersion = "26.0.2"
+ supportLibVersion = "26.1.0"
+ googlePlayServicesVersion = "11.8.0"
+ firebaseVersion = "11.8.0" // <-- if you're using react-native-firebase
+ androidMapsUtilsVersion = "0.5+" // <-- for react-native-maps
+}
android/app/build.gradle
android {
+ compileSdkVersion rootProject.compileSdkVersion
+ buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
+ targetSdkVersion rootProject.targetSdkVersion
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
+ compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
compile "com.facebook.react:react-native:+" // From node_modules
}
This provides a much better mechanism for aligning play-services
version than all the nasty business of exclude group
:
groovy
...
dependencies {
...
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
Thanks, @christocracy and @isnifer .
@christocracy correct me if I wrong understand. Your solution will help us only if the 3rd-party module supports it, yes? For example, if 3rd-party module just uses a wildcard version as "+" instead of $firebaseVersion — it won't work.
@isnifer Correct. Third-party modules must be listening for these variables. More and more are doing so. Hopefully this event provides a "kick-in-the-pants" to all module developers :)
There should be no more version:+
.
@christocracy thank you, that means, we need to use it in tipsi-stripe
too.
If you've already changed version at /android/build.gradle but not work yet. Maybe you need check some library package at node_modules. Eg: react-native-onesignal also compile some play-services with highest version (they use +) so it can make this issue.
You can put a script at root directory and add {"scripts": {"postinstall": "node changeVersionGoogleService.js"
}} in package .json so it can run to auto change your version when you npm install.
This is the script: https://gist.github.com/duytq94/47ef945131b61de538447d449813b3d4
My script at now auto change version 'react-native-onesignal',
'react-native-admob',
'react-native-maps',
'react-native-google-sign-in'
@isnifer Haha. I had an issue posted at my react-native-background-geolocation
module involving tipsi-stripe
. I meant to send the same PR there that I sent to react-native-maps
:)
If anyone is using a module with hard-coded play-services
/ firebase
version (eg: :+
), send them a link to my PR at react-native-maps
. It's a very easy and non-invasive thing for a module-developer to implement.
@isnifer (from private repo so screenshot)
@christocracy haha, we will release v5 today. @ngoryachev working on changelog now. See you soon)
Right now at Google, the guy that release the 12.0.0 update: "This is gonna cost me"
My only fix, after trying everything, was to add the following to the android/build.gradle
:
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-auth:11.8.0"
}
}
}
}
@gesf I've had to do something similar as one of my dependencies doesn't support the googlePlayServicesVersion variable (yet). There's a PR on that repo to update it, so maybe keep an eye out on the dependencies that are broken to see if they're updated in the near future (or have been already). Then you should be able to remove the configurations.all section and we can all breathe a sigh of relief!
This is how i fixed in my project (the com.android.support bit was already there, I added com.google.android.gms and com.google.firebase)
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
if (requested.group == 'com.google.android.gms') {
details.useVersion '11.8.0'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '11.8.0'
}
}
}
}
@jigaryadav , @AndrejGajdos, @isnifer
I have changed in all places of properties file to 11.+, got a different error this time :thinking: :thinking:
here is my prorerties file
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
cordova.system.library.1=com.google.gms:google-services:11.+
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:11.+
cordova.system.library.3=com.google.firebase:firebase-core:11.+
cordova.system.library.4=com.google.firebase:firebase-messaging:11.+
cordova.system.library.5=com.google.firebase:firebase-crash:11.+
cordova.system.library.6=com.google.firebase:firebase-config:11.+
and the Error is:
What went wrong:
A problem occurred configuring root project ‘android’.
Could not resolve all dependencies for configuration ‘:_debugApkCopy’.
BUILD FAILED
Total time: 8.075 secs
Could not find any version that matches com.google.gms:google-services:11+.
Versions that do not match:
3.2.0
3.1.2
3.1.1
3.1.0
3.0.0
For this i have added android version code and ios-CFBundleVersion to my config.xml, still same error
can anyone help me on this?
@vsreddy91 You are seeking Cordova assistance at a React Native thread.
That's like seeking help for your Honda at a Tesla dealership.
@poppiestar, thanks a lot for your input! I think you're right. To be safe, I'm going to apply @joeflateau (also thanks for it) technique, for now!
I got this error:
"What went wrong:
Execution failed for task ':RNDeviceInfo:processReleaseResources'.
Error: more than one library with package name 'com.google.android.gms.license'"
Can anyone help me? Thanks!
@arcbook126 react-native-device-info
is aware of the Gradle Configuration Property googlePlayServicesVersion
. Configure it to 11.8.0
, as instructed in my comment above
cd android && ./gradlew app:dependencies --configuration compile
jot down this command it will tell you what version of Google play is used in all imported libraries.
Open project in studio and in all third party libraries replace
compile 'com.google.firebase:firebase-messaging:+' with specific version like this.
compile 'com.google.firebase:firebase-messaging:11.8.0'
you may be using other libraries not only fcm ,vison or whatever but rule of thumb is declare to use specific version of it it will make your life easy.
Thanks.
@christocracy we did release
@isnifer But you didn't implement googlePlayServicesVersion
or supportLibVersion
variables?
Here's something that might help: If you're depending on one or more modules that haven't fixed their gradle dependency version yet, you can use patch-package to edit the version within node_modules
and generate a patch that will persist even on build or CI servers, without the need to fork your own copy of the module's repository.
@christocracy They changed to 11.8 instead. @isnifer Are you guys able to track down the breaking changes from 11.8 to 12?
@christocracy yes, we did a PR yesterday, but #PlayServicesGate did today :) You can help us)
@coreh yeah, nice!
@yangtaufoo do you tell about tipsi-stripe
?
@isnifer I don't get what you mean.
Anyways, I realised that exclude group
is deprecated (not sure about this), but take a look @ https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#exclude_dependencies or maybe the dependency keywords changed (https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations)
Edit 1 - Found further supporting source (https://stackoverflow.com/questions/48365687/gradle-exclude-group-from-compile). Thus, compile is still usable and this solution might work. Have to test it out.
From
exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
To
variant.getCompileConfiguration().exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
+1 started getting this today too
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
android/app/build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.1'
}
}
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "....."
minSdkVersion 16
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
repositories {
flatDir {
dirs "../../node_modules/react-native-background-geolocation/android/libs"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-maps')
compile project(':react-native-check-app-install')
compile project(':react-native-vector-icons')
compile project(':react-native-splash-screen')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
compile "com.facebook.react:react-native:+" // From node_modules
compile(project(':react-native-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile(name: 'tslocationmanager', ext: 'aar')
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms'
}
compile ('com.google.android.gms:play-services-location:+') {
force = true;
}
compile ("com.google.android.gms:play-services-base:+") {
force = true;
}
compile ("com.google.android.gms:play-services-maps:+") {
force = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
@christocracy , I tried your method but it didn't work out.
@EsdrasEtrenne I just published react-native-background-geolocation @ 2.12.0-beta.1
about 7 minutes ago. It's published now to npm.
oh awesome,
update I fixed my dependencies to remove the exclude at it works...
I just realized you were saying that if you have those global configs you can remove the exclude
dependencies {
compile project(':react-native-maps')
compile project(':react-native-check-app-install')
compile project(':react-native-vector-icons')
compile project(':react-native-splash-screen')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-background-geolocation')
compile(name: 'tslocationmanager', ext: 'aar')
compile project(':react-native-maps')
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true
}
@EsdrasEtrenne You'll want to pay close attention to the new Android setup docs. Much has changed. Pretend you're installing the plugin for the first time. If you have further issues, post an issue at the repo.
We fixed it by forcing all com.google.android.gms
to specific version
in /android/app/gradle.properties
:
...
googlePlayServicesVersion=11.8.0
...
in /android/app/build.gradle
:
...
dependencies {
...
compile ("com.google.android.gms:play-services-auth:$googlePlayServicesVersion") {force = true}
compile ("com.google.android.gms:play-services-analytics:$googlePlayServicesVersion") {force = true}
compile ("com.google.android.gms:play-services-location:$googlePlayServicesVersion") {force = true}
compile ("com.google.android.gms:play-services-gcm:$googlePlayServicesVersion") {force = true}
...
}
...
in /android/build.gradle
:
def googlePlayServicesVersion = googlePlayServicesVersion
...
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
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"
force "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"
}
}
}
}
Now it works flawlessly 🎉 🎉 🎉
mark
@dwicao you can actually move the def in gradle.properties
to android/build.gradle
and put it like this...
buildscript {...}
allprojects {...}
ext {
googlePlayServicesVersion=11.8.0
}
googlePlayServicesVersion
will then be available throughout your gradles.
This worked yesterday then suddenly stops working today. I don't know who to really blame and this is really annoying. I am already doing similar to what have been suggested (using ext to define global variable and do exclude + force combo in compile) but still getting error, I'm out of ideas. Currently forcing google all play services to 11.6.2 (see below). Also I'm on a detached expo project.
....
compile(...) {
exclude group: 'com.google.android.gms'
}
compile ("com.google.android.gms:play-services:11.6.2") {
force = true;
}
Capture the output of:
$ cd android
$ ./gradlew app:dependencies
Save to file and attach. Do not paste the output into this thread, it’s too long.
@christocracy https://gist.github.com/pencilcheck/ed4a4a3ab5f9e2228c5772df1c8a901a here is the output.
What's weird is that I can't find any library that named "...android.gms.license"
What a mess is Expo. Edit your previous comment and post your app/build.gradle to another gist.
Thanks for taking the time. Here is the gist to app/build.gradle: https://gist.github.com/pencilcheck/d4cf17590430ec639db596e41c36d831
Support lib version must match compileSdkVersion. When compileSdkVersion 26
, you must use corresponding version 26 of support lib, eg 26.1.0
.
You’re specifying a support lib version from 23
After changing to 26.1.0 for the support lib version using the variable defined above, the problem persists, i'm still getting the same error.
It's weird, I thought the solution in this thread should enforces for all dependencies in all sub-projects isn't it?
Since this error originated from react-native-device-info, changing the support lib version prob doesn't really affect that.
Error:Execution failed for task ':react-native-device-info:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
react-Native-device-info understands the variable specifically named supportLibVersion
and are you using the latest version of react-native-device-info
?
See the Wiki from my react-native-background-geolocation
You'll want to define ext.googlePlayServicesVersion
. react-native-device-info
is aware of this variable too.
@pencilcheck Do this in ur android/build.gradle
buildscript {...}
allprojects {...}
ext {
googlePlayServicesVersion=11.8.0
}
@christocracy
Actually, no i'm not. It was 0.11.0, now upgraded to 0.21.2 and tried it again and it seems to work now with your workaround.
Thanks!
@yangtaufoo yea I was actually using older version of the library that's why it wasn't aware of the changes. But still appreciate the help and comment. Thanks!
Haha, now the error went away but reappear in "react-native-onesignal", damn it!
@pencilcheck its on all the libraries that uses GMS, i think u need to fork and apply the gradle changes if they have not support it yet. My initial guess is we (all packages using GMS) might need to move com.android.tools.build:gradle
, buildToolsVersion
, com.android.support:appcompat-v7
, com.google.gms:google-services
to the latest version supporting the 3.0 gradle plugin.
You are screwed with one-signal. As you can see, their versions are all hard-coded. That module is unaware of your gradle config properties. They need my PR I sent to ‘react-native-maps`, posted above in this thread.
The latest Google Play Services packages caused the problem. In my app, I used the following packages - react-native-google-signin, react-native-google-analytics-bridge, react-native-device-info. Each of them has the dependency with com.google.android.gms. In each package's build gradle file, you will find something similar like this - com.google.android.gms:play-services-auth:+. The + will pull the lastest the package and it caused the problem. Here is the temporary fix if you don't want to upgrade the packages and set the env variable for the version -
in you top level build gradle file, add the following code -
allprojects {
repositories {
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-auth:11.8.0"
force "com.google.android.gms:play-services-gcm:11.8.0"
}
}
...
Modified the build.gradle file inside cordova-plugin-firebase
compile 'com.google.firebase:firebase-crash:11.+'
compile 'com.google.firebase:firebase-auth:11.+'
And the project.properties file
target=android-25
android.library.reference.1=CordovaLib
cordova.gradle.include.3=cordova-plugin-firebase/project-build.gradle
cordova.system.library.3=com.google.gms:google-services:+
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:11.+
cordova.system.library.5=com.google.firebase:firebase-core:11.+
cordova.system.library.6=com.google.firebase:firebase-messaging:11.+
cordova.system.library.7=com.google.firebase:firebase-crash:11.+
cordova.system.library.8=com.google.firebase:firebase-config:11.+
And finally my issue got fixed was able to build project properly
@Karthikeyan-Pandian your changes done properly but still not working.
Changes build.gradle file inside cordova-plugin-firebase (plugins\cordova-plugin-firebase\src\android)
dependencies {
compile 'me.leolin:ShortcutBadger:1.1.4@aar'
compile 'com.google.firebase:firebase-crash:11.+'
compile 'com.google.firebase:firebase-auth:11.+'
}
And the project.properties file
cordova.gradle.include.1=cordova-plugin-firebase/android-build.gradle
cordova.system.library.2=com.google.gms:google-services:+
cordova.system.library.3=com.google.firebase:firebase-core:11.+
cordova.system.library.4=com.google.firebase:firebase-messaging:11.+
cordova.system.library.5=com.google.firebase:firebase-crash:11.+
cordova.system.library.6=com.google.firebase:firebase-config:11.+
@Lifesoftware
Did u removed the android platform ?
If not remove and add the platform after updating the build.gradle inside the cordova-plugin-firebase folder and after the adding the platform update the project.properties file then build and check once
If that doesn't work let me know I have another fix we can try with that.
@Karthikeyan-Pandian Its Working for me. Thanks for giving solution 🎉 🎉 🎉
I'm able to get it to compile with 12.0.0
. However, some libraries might break. Still figuring out the extend of damage. (Edit: Using 11.8.0 below as many of the 3rd party libraries do not have the android implementation for 12.0.0, but this implementation will ease upgrading in the near future)
But this is what I've done,
gradle-wrapper.properties
, change distributionUrl
to https\://services.gradle.org/distributions/gradle-4.1-all.zip
ext
object in android/build.gradle
ext {
googlePlayServicesVersion = '11.8.0'
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibrariesVersion = '27.1.0'
}
// Force sub libs to use the compile sdk & build tools version
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
app/build.gradle
, changed all compile
to implementation
, used project defined ext object variables in android/build.gradle
(i.e. implementation "com.google.android.gms:play-services-gcm:$project.googlePlayServicesVersion"
android/build.gradle
, make sure your dependencies are as followsbuildscript {
repositories { ... }
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
}
}
Edit: Fix works for 12.0.0 (compile and runs project successfully). However, note the above about using 11.8 instead.
Simple solution is find com.google.firebase in all folder and change
After
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
Before
compile "com.google.firebase:firebase-core:11.+"
compile "com.google.firebase:firebase-messaging:11.+"
compile "com.google.firebase:firebase-crash:11.+"
compile "com.google.firebase:firebase-config:11.+"
This link fix the same problem and I tried it, and it works for me, you can check it here
Regarding this: https://github.com/facebook/react-native/issues/18479#issuecomment-375170840
@pencilcheck I'm pretty sure you have a typo at this line:
Replace
if (details.requested.group == 'com.android.gms' ) {
with
if (details.requested.group == 'com.google.android.gms' ) {
My approach is scan all android project and update version of google play services directly to each module build.gradle
Detail here: https://medium.com/p/2fd245027832
Hope it can help you.
@nhancv This doesn't constitute as a fix. A fix is when you are able to use 12.0.0 as intended.
This issue isn't relevant to the React Native project. This project doesn't include any gms/firebase dependencies, so can be closed.
Raise an issue with the libraries that use gms dependencies with a +
. It's generally bad practise to use wildcards if you want repeatable builds.
As a handy workaround add this to your android/build.gradle
(similar to @weihuali0509's solution but more complete)
subprojects {
ext {
playServicesVersion = '11.8.0'
}
project.configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force dependencies to use the same version.
def versionSelector = details.requested
if (versionSelector.group == 'com.google.firebase'
|| versionSelector.group == 'com.google.android.gms') {
details.useVersion playServicesVersion
}
}
}
}
}
I did find a temporary fix.
Try to find all your packages with gms included in your node modules.
Do this to your android/build.gradle
allprojects {
repositories {
// Temp fix for com.google.android.gms.license
configurations.all {
resolutionStrategy {
// Put your gms packages here with 11.8.0 attached
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-auth:11.8.0"
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-location:11.8.0"
}
}
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
I fixed the problem with to edit this from "android/app/build.gradle" and also changed this from which library was creating issues "node_modules\react-native-camera\androidbuild.gradle"
===>>> "com.google.android.gms:play-services-vision:11.+"
I've tried everything since yesterday, from gradle to post install node scripts, with every versions : may it be 11.6.0
11.8.0
12.0.0
and versions of Android build tools 26 and 27, absolutely nothing worked, it always gives the same error message Error: more than one library with package name 'com.google.android.gms.license'
The only thing that varies is the module from which this error is spit...
you guys might want to try out my solution (https://github.com/facebook/react-native/issues/18479#comment-375200874) i have it up and running. Need some additions for assembleRelease command, other than that it’s working fine
I tried everything you suggested since 2 hours @yangguang2009 my gradle files are now a lot cleaner now ;) but it won't affect the end result at all
The only thing that didn't work for me is the following:
In gradle-wrapper.properties, change distributionUrl to https\://services.gradle.org/distributions/gradle-4.1-all.zip
@btoueg Can you post snippets of your gradle files?
I'm build ReactNative from source, that's why I can't easily bump gradle to 4.1
@yangtaufoo Here is my root build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'de.undercouch:gradle-download-task:3.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
googlePlayServicesVersion = '12.0.0'
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibrariesVersion = '27.1.0'
}
// Force sub libs to use the compile sdk & build tools version
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://jitpack.io'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
I've been playing with all sorts of googlePlayServicesVersion
, compileSdkVersion
, buildToolsVersion
, supportLibrariesVersion
And my app build.gradle
:
apply plugin: "com.android.application"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
def enableProguardInReleaseBuilds = true
android {
compileSdkVersion "$project.compileSdkVersion"
buildToolsVersion "$project.buildToolsVersion"
}
configurations.all {
exclude group: 'com.facebook.react', module: 'react-native'
resolutionStrategy {
eachDependency { details ->
// Force dependencies to use the same version.
def requested = details.requested
if (requested.group.startsWith('com.google.android.gms')) {
details.useVersion "$project.googlePlayServicesVersion"
}
if (requested.group == 'com.google.firebase') {
details.useVersion "$project.googlePlayServicesVersion"
}
if (requested.group == 'com.android.support' && !requested.name.startsWith('multidex')) {
details.useVersion "$project.supportLibrariesVersion"
}
}
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
// force certain versions of dependencies (including transitive)
// *append new forced modules:
force 'me.leolin:ShortcutBadger:1.1.10'
force 'com.android.support:multidex:1.0.3'
force 'com.facebook.fresco:fbcore:0.13.0'
force 'com.facebook.fresco:imagepipeline:0.13.0'
force 'com.squareup.okhttp3:okhttp:3.5.0'
force 'com.yqritc:android-scalablevideoview:1.0.3'
force 'com.google.code.gson:gson:2.3.1'
force 'com.google.zxing:core:3.2.1'
force 'com.squareup.okio:okio:1.13.0'
}
}
dependencies {
configurations.all {
exclude group: 'com.facebook.react', module: 'react-native'
}
compile fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:$project.supportLibrariesVersion"
implementation 'com.yqritc:android-scalablevideoview:1.0.4'
implementation 'com.amazonaws:aws-android-sdk-core:2.3.0'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.3.0'
implementation 'com.amazonaws:aws-android-sdk-s3:2.3.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.facebook.fresco:animated-gif:0.13.0'
compile project(':react-native-video')
compile project(':react-native-fs')
compile project(':react-native-orientation')
compile project(':react-native-image-picker')
compile project(':reactdate')
compile project(':react-native-maps') // make use of $project.googlePlayServicesVersion
compile project(':react-native-push-notification')
compile project(':react-native-vector-icons')
compile project(':react-native-fbsdk')
compile project(':react-native-camera')
compile project(':react-native-blur')
compile project(':react-native-linear-gradient')
compile project(':react-native-fcm')
compile project(':react-native-sentry')
implementation "com.google.android.gms:play-services-gcm:$project.googlePlayServicesVersion"
implementation "com.google.android.gms:play-services-location:$project.googlePlayServicesVersion"
implementation "com.google.android.gms:play-services-vision:$project.googlePlayServicesVersion"
implementation 'com.android.support:multidex:1.0.3'
implementation "com.google.firebase:firebase-core:$project.googlePlayServicesVersion"
implementation "com.google.firebase:firebase-messaging:$project.googlePlayServicesVersion"
compile project(':ReactAndroid') // make sure to keep this dependency last in the list
}
apply plugin: 'com.google.gms.google-services'
For those still facing the issue I will try to clearly lay out how to fix it, and what is going on. First, if you are getting this error there is a high chance either your code, or an included npm package has the lines
compile 'com.google.android.gms:play-services-XXXXXXX:+'
somewhere in a build.gradle
file, where the XXXXX
is one of the google play services like auth
or location
. a good example is react-native-fused-location.
Now to force a version for all libraries that are compiling to the +
version you need to enforce a version, you do that in your root android/build.gradle
file adding the configuration.all
section in the below example:
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
...
...
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-location:11.8.0"
}
}
}
}
I would also follow @christocracy said above and setup variables for other libraries to consume in this file, example:
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
androidMapsUtilsVersion = "0.5+" // <-- for react-native-map
}
PLEASE NOTE - there are various play services you might want to setup a resolution strategy for based on what library is throwing the issue, i.e. play-services-auth
, etc.
then in you android/app/build.gradle
file use the rootProject variables i.e.
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.driver"
minSdkVersion 16
targetSdkVersion rootProject.targetSdkVersion
googlePlayServicesVersion = rootProject.googlePlayServicesVersion
...
and make sure your dependencies aren't forcing compilation of any specific versions of google-play services, and compile the appcompat version from your rootProject. an example of my config
dependencies {
compile project(':react-native-background-geolocation')
compile project(':react-native-background-fetch')
compile project(':react-native-maps')
compile project(':react-native-fused-location')
compile project(':react-native-image-picker')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
}
@btoueg you might wanna change these in your build.gradle
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
I'm posting my medium post on this issue. Do check it out and let me know if there are any problems!
https://medium.com/@chuckyong_3313/react-native-android-build-compilation-issue-with-google-play-api-for-android-v12-0-0-ccb2f1a0fb9c
For me, onesignal is the only node module that makes use of google play services in my project, so I simply changed the following in /node_modules/react-native-onesignal/android/build.gradle
:
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
to
compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.google.android.gms:play-services-analytics:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
just changed the +
to 11.8.0
and ran the project and it worked fine. Not sure if this is a good solution but it's for sure really short and simple. You'll need to do it for all your modules making use of google play services. May not be the best solution if you have a lot of them.
sooooo many issues using React-Native.
I just wanted to use camera in react-native, couldn't do in the past 2 days.
getting different error every-time, now "more than one lib" error.
If anyone having working solution of react-native-camera then please share.
@mk48 This error comes from google, google launched 12.0.0 with errors. Thats the whole problem at this moment
Thanks @KoenvGinkel , I will stop my current react-native project for next 2 days, will resume after that.
hopefully this will be resolved that time.
@mk48 follow this, this may help you,
Edit this from "android/app/build.gradle" and also changed this from which library was creating issues "node_modules\react-native-camera\androidbuild.gradle"
===>>> "com.google.android.gms:play-services-vision:11.+"
@yangguang2009 thanks, all the info have been very valuable to me
I did not get I had to change the classpath until https://github.com/facebook/react-native/issues/18479#issuecomment-375523567 and I didn't even know you could de-synchronized the version of the gradle-wrapper with the version of the classpath (which made things quite unclear)
I find your Medium blog post thorough and I'm very grateful for it.
Now that I've get rid of the gms.license
issue, I'm left with this error which happens after compilation:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processProReleaseResources'.
> Failed to execute aapt
I hope it'll be easier to solve ;)
@btoueg There is a known issue with Build Tools 3 (https://github.com/facebook/react-native/issues/16906) causing a build for release to fail. The fix is to add android.enableAapt2=false
to android/gradle.properties
as a temporary workaround.
Yes, I've found it also: https://github.com/react-navigation/react-navigation/issues/3097#issuecomment-358351112
Thanks
@Karthikeyan-Pandian @Lifesoftware
cordova.system.library.2=com.google.gms:google-services:11+
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:11+
cordova.system.library.4=com.google.firebase:firebase-core:11+
cordova.system.library.5=com.google.firebase:firebase-messaging:11+
cordova.system.library.6=com.google.firebase:firebase-crash:11+
cordova.system.library.7=com.google.firebase:firebase-config:11+
cordova.system.library.8=com.google.android.gms:play-services-analytics:11+
cordova.system.library.9=com.google.android.gms:play-services-auth:11+
cordova.system.library.10=com.google.android.gms:play-services-identity:11+
After changing in project properties
i added platform
then change in build
dependencies {
compile 'me.leolin:ShortcutBadger:1.1.4@aar'
compile 'com.google.firebase:firebase-crash:11.+'
compile 'com.google.firebase:firebase-auth:11.+'
}
but still shows error
Could not find any version that matches com.google.gms:google-services:11+.
Versions that do not match:
3.1.1
3.1.0
3.0.0
2.1.2
2.1.0
+ 42 more
Required by:
project :
Thanks @muhammadmisbah, it solved the camera issue. Thanks :)
After updating my gradle all seemed working fine.
maybe you guys are running old versions of gradle?
My current version now is 4.6
https://gradle.org/install/
After updating my gradle I deleted the gradle folder in my android folder.
Ran it with androidstudio, that fixed it.
@yangtaufoo After solving the error by following ur medium tutorial and my build success, but after that my app closes as soon as open... Is there any solution for this??
@KoenvGinkel That didn't helped me :/
@yangtaufoo @Vijay-clustrex same problem is happening to me. After the error has been solved, and the build is finally successful, the app crashes instantly upon opening. Any help is much appreciated.
For those with app crashing, do a "adb logcat" in the console and start the app and look for fatal crashes, stack traces, etc. That should give you a hint.
I had the similar issue with coming due to react-native-push-notification
and firebase
used together. Here is what I did after many many hours figuring it out:
1) android/app/build.gradle
fix it to a specific version insetad of +
compile 'com.google.firebase:firebase-core:12.0.1'
2) android/build.gradle
add the following to allprojects
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-gcm:12.0.1'
}
}
3) CD to the android folder from shell and run the clean
$> gradlew clean
react-native-push-notification merged their gradle properties today.
Firebase already supports them.
@Vijay-clustrex @emilklindt Will need more information to be able to help. any logs is appreciated
Using the latest version "compile 'com.google.firebase:firebase-core:12.0.1'" resolved the problem for me.
As suggested by @nopedev, the solution for me was to force version-specific resolution of dependencies. I was experiencing problems with react-native-device-info and react-native-background-geolocation (see https://github.com/transistorsoft/react-native-background-geolocation/issues/375).
Below is the configuration that ended up solving it for me, which is just a slight modification of what @nopedev originally commented, adding a few more libraries:
def googlePlayServicesVersion = '11.8.0'
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"
// react-native-device-info
force "com.google.android.gms:play-services-basement:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-iid:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-iid-license:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-gcm-license:$googlePlayServicesVersion"
// react-native-background-geolocation
force "com.google.android.gms:play-services-basement-license:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-tasks:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-tasks-license:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-base-license:$googlePlayServicesVersion"
}
...
}
This seems to be fixed after Google rolled out the patch (12.0.1
) to Play Services and Firebase.
All,
Whilst forcing the GPS/GMS versions to be lower than v12 works (as suggested above) I don't think this is a long term solution and you'll eventually be unable to use some libraries that do keep up to date with GMS versions such as ourselves (react-native-firebase
).
The approach I'd recommend would be to update your android project to use the latest gradle wrapper and android build tools - most projects are far behind version wise on this.
Here's some instructions taken from our React Native Firebase v4 change log that should help you do this:
Due to some breaking changes in v12 of the Android libs, you'll need to upgrade your Gradle version to at least v4.4 and make a few other tweaks as follows:
1) In android/gradle/wrapper/gradle-wrapper.properties
, update the gradle URL to gradle-4.4-all.zip
2) In android/build.gradle
check that you have google()
specified in the buildScript repositories section:
buildscript {
repositories {
jcenter()
google() // <-- Check this line exists
...
}
3) In android/build.gradle
update Android build tools to version 3.1.0
:
classpath 'com.android.tools.build:gradle:3.1.0'
4) In android/app/build.gradle
update all your compile
statements to be implementation
, e.g.
implementation(project(':react-native-firebase')) {
transitive = false
}
5) In android/app/build.gradle
, update all the firebase and gms dependencies to 12.0.1
In an ideal world RN modules are all kept up to date on gradle dependencies and such; but in the real world most might never upgrade their GMS versions/gradle build files, this isn't the end of the line though. You can successfully patch any of the modules you want to change the versions / dependency definitions of (e.g. to use the new gradle api/implementation/compileOnly syntax) using the patch-package npm module.
It's pretty straight-forward:
node_modules
dir and get them all building successfully togetherpatch-package modulename-1 modulename-2 etc
in the root of your project and it will create a patches directory in your project (contains all the changes you made in node_modules for each of the packages you specified in the command)post-install
script on your package.json
and it will auto patch after every npm/yarn installLinks for reference:
https://github.com/invertase/react-native-firebase/blob/master/android/build.gradle#L83
https://github.com/invertase/react-native-firebase/blob/master/tests/android/app/build.gradle#L75
Wait, is RN supporting the latest gradle now? I had nothing but troubles using v3.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
This worked for me. Edit
/android/build.gradle
.(not/android/app/build.gradle
)You need to check what gms modules are required for your project. You can find required gms modules at each
build.gradle
file of each react-native plugins which using gms.In my case I needed to check next 4 plugins.
react-native-admob
,react-native-maps
,react-native-onesignal
,react-native-google-sign-in
. The module names can be different by project.or, You can check the required module names by running command
gradlew app:dependencies
.(run in the android directory)