Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more than one library with package name 'com.google.android.gms.license' #18479

Closed
ColdDay opened this issue Mar 21, 2018 · 162 comments
Closed

more than one library with package name 'com.google.android.gms.license' #18479

ColdDay opened this issue Mar 21, 2018 · 162 comments

Comments

@ColdDay
Copy link

@ColdDay ColdDay commented Mar 21, 2018

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

Steps to Reproduce

Expected Behavior

Actual Behavior

@react-native-bot

This comment has been minimized.

Copy link
Collaborator

@react-native-bot react-native-bot commented Mar 21, 2018

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.

@nopedev

This comment has been minimized.

Copy link

@nopedev nopedev commented Mar 21, 2018

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)

@eargaez

This comment has been minimized.

Copy link

@eargaez eargaez commented Mar 21, 2018

the same happened to me but with cordova, without having made any modification to my code

@ColdDay

This comment has been minimized.

Copy link
Author

@ColdDay ColdDay commented Mar 21, 2018

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

@justcarthy

This comment has been minimized.

Copy link

@justcarthy justcarthy commented Mar 21, 2018

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.

@Bharatchavan20

This comment has been minimized.

Copy link

@Bharatchavan20 Bharatchavan20 commented Mar 21, 2018

  • 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'

@edem

This comment has been minimized.

Copy link

@edem edem commented Mar 21, 2018

I suffered the same problem. It's OK last afternoon, but build error this morning.
FAILURE: Build failed with an exception.

  • 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'

My environment as below:
react-native-cli: 2.0.1
react-native: 0.44.3
npm: 5.5.1
OS : Windows 10

@justcarthy

This comment has been minimized.

Copy link

@justcarthy justcarthy commented Mar 21, 2018

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

@kyo504

This comment has been minimized.

Copy link
Contributor

@kyo504 kyo504 commented Mar 21, 2018

There is a relevant issue you can refer to.

@augusto-altman

This comment has been minimized.

Copy link

@augusto-altman augusto-altman commented Mar 21, 2018

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.

@sangupandi

This comment has been minimized.

Copy link

@sangupandi sangupandi commented Mar 21, 2018

I just fixed by adding the below line in gradle.properties

googlePlayServicesVersion=11.6.0 .

@ColdDay

This comment has been minimized.

Copy link
Author

@ColdDay ColdDay commented Mar 21, 2018

compile 'com.google.android.gms:play-services-vision:11.8.0'
11.8.0 is OK

@augusto-altman

This comment has been minimized.

Copy link

@augusto-altman augusto-altman commented Mar 21, 2018

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:
     ...
@lever1225

This comment has been minimized.

Copy link

@lever1225 lever1225 commented Mar 21, 2018

@justcarthy Yeah, it works.

@manojbhardwaj

This comment has been minimized.

Copy link

@manojbhardwaj manojbhardwaj commented Mar 21, 2018

resource found that matches the given name: attr 'android:keyboardNavigationCluster'. i got this error

@kyo504

This comment has been minimized.

Copy link
Contributor

@kyo504 kyo504 commented Mar 21, 2018

@augusto-altman You could try this one.

@eargaez

This comment has been minimized.

Copy link

@eargaez eargaez commented Mar 21, 2018

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.

@jmsv23

This comment has been minimized.

Copy link

@jmsv23 jmsv23 commented Mar 21, 2018

  • 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

@edem

This comment has been minimized.

Copy link

@edem edem commented Mar 21, 2018

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:+'
}

@nopedev

This comment has been minimized.

Copy link

@nopedev nopedev commented Mar 21, 2018

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"
            }
        }
				...
    }
}
@isnifer

This comment has been minimized.

Copy link
Contributor

@isnifer isnifer commented Mar 21, 2018

#PlayServicesGate

@ZKeLin

This comment has been minimized.

Copy link

@ZKeLin ZKeLin commented Mar 21, 2018

how to solve it? help help

@isnifer

This comment has been minimized.

Copy link
Contributor

@isnifer isnifer commented Mar 21, 2018

@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

@ZKeLin

This comment has been minimized.

Copy link

@ZKeLin ZKeLin commented Mar 21, 2018

I can not install ...play-services-*:11.8.0 . why? duo to my android studio is too old?

chanthouNim added a commit to chanthouNim/react-native-camera that referenced this issue Mar 21, 2018
Problem of Google Play Service: facebook/react-native#18479
@mk48

This comment has been minimized.

Copy link

@mk48 mk48 commented Mar 23, 2018

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.

@muhammadmisbah

This comment has been minimized.

Copy link

@muhammadmisbah muhammadmisbah commented Mar 23, 2018

@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\android\build.gradle"

===>>> "com.google.android.gms:play-services-vision:11.+"

@btoueg

This comment has been minimized.

Copy link

@btoueg btoueg commented Mar 23, 2018

@yangguang2009 thanks, all the info have been very valuable to me

I did not get I had to change the classpath until #18479 (comment) 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 ;)

@yangtaufoo

This comment has been minimized.

Copy link

@yangtaufoo yangtaufoo commented Mar 23, 2018

@btoueg There is a known issue with Build Tools 3 (#16906) causing a build for release to fail. The fix is to add android.enableAapt2=false to android/gradle.properties as a temporary workaround.

@btoueg

This comment has been minimized.

Copy link

@btoueg btoueg commented Mar 23, 2018

Yes, I've found it also: react-navigation/react-navigation#3097 (comment)

Thanks

@smayur00

This comment has been minimized.

Copy link

@smayur00 smayur00 commented Mar 24, 2018

@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 :

@mk48

This comment has been minimized.

Copy link

@mk48 mk48 commented Mar 26, 2018

Thanks @muhammadmisbah, it solved the camera issue. Thanks :)

@KoenvGinkel

This comment has been minimized.

Copy link

@KoenvGinkel KoenvGinkel commented Mar 26, 2018

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.

@Vijay-clustrex

This comment has been minimized.

Copy link

@Vijay-clustrex Vijay-clustrex commented Mar 27, 2018

@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??

@AdnanRibic

This comment has been minimized.

Copy link

@AdnanRibic AdnanRibic commented Mar 27, 2018

@KoenvGinkel That didn't helped me :/

@emilklindt

This comment has been minimized.

Copy link

@emilklindt emilklindt commented Mar 27, 2018

@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.

@sfratini

This comment has been minimized.

Copy link

@sfratini sfratini commented Mar 27, 2018

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.

@Rah1x

This comment has been minimized.

Copy link

@Rah1x Rah1x commented Mar 27, 2018

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

@christocracy

This comment has been minimized.

Copy link

@christocracy christocracy commented Mar 27, 2018

react-native-push-notification merged their gradle properties today.

Firebase already supports them.

@yangtaufoo

This comment has been minimized.

Copy link

@yangtaufoo yangtaufoo commented Mar 28, 2018

@Vijay-clustrex @emilklindt Will need more information to be able to help. any logs is appreciated

@send2deb

This comment has been minimized.

Copy link

@send2deb send2deb commented Mar 28, 2018

Using the latest version "compile 'com.google.firebase:firebase-core:12.0.1'" resolved the problem for me.

@hramos hramos removed the Platform: macOS label Mar 29, 2018
@emilklindt

This comment has been minimized.

Copy link

@emilklindt emilklindt commented Apr 3, 2018

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 transistorsoft/react-native-background-geolocation#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"
  }

  ...
}
@christophermark

This comment has been minimized.

Copy link

@christophermark christophermark commented Apr 3, 2018

This seems to be fixed after Google rolled out the patch (12.0.1) to Play Services and Firebase.

@Salakar

This comment has been minimized.

Copy link
Collaborator

@Salakar Salakar commented Apr 5, 2018

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:

Upgrading gradle and Android build tools


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
        ...
    }
  1. In android/build.gradle update Android build tools to version 3.1.0:
classpath 'com.android.tools.build:gradle:3.1.0'
  1. In android/app/build.gradle update all your compile statements to be implementation, e.g.
implementation(project(':react-native-firebase')) {
    transitive = false
}
  1. In android/app/build.gradle, update all the firebase and gms dependencies to 12.0.1

Patching outdated RN modules

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:

  1. Change/correct the modules you have issues with inside your node_modules dir and get them all building successfully together
  2. Once your android project builds and runs smoothly then run patch-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)
  3. Commit this new directory as part of your git repo
  4. Add patch-package as a post-install script on your package.json and it will auto patch after every npm/yarn install
  5. Profit 🎉

Links 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

@sfratini

This comment has been minimized.

Copy link

@sfratini sfratini commented Apr 5, 2018

Wait, is RN supporting the latest gradle now? I had nothing but troubles using v3.

@stale

This comment has been minimized.

Copy link

@stale stale bot commented Aug 16, 2018

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.

@stale stale bot added the Stale label Aug 16, 2018
@stale

This comment has been minimized.

Copy link

@stale stale bot commented Sep 6, 2018

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.

@stale stale bot closed this Sep 6, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.