facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
116.25k stars 23.99k forks source link

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

Closed ColdDay closed 5 years ago

ColdDay commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

ColdDay commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago
edem commented 6 years ago

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

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

justcarthy commented 6 years ago

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 commented 6 years ago

There is a relevant issue you can refer to.

augusto-altman commented 6 years ago

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 commented 6 years ago

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

googlePlayServicesVersion=11.6.0 .

ColdDay commented 6 years ago

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

augusto-altman commented 6 years ago

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 commented 6 years ago

@justcarthy Yeah, it works.

manojbhardwaj commented 6 years ago

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

kyo504 commented 6 years ago

@augusto-altman You could try this one.

eargaez commented 6 years ago

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 commented 6 years ago
  • 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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

#PlayServicesGate

ZKeLin commented 6 years ago

how to solve it? help help

isnifer commented 6 years ago

@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 commented 6 years ago

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

abduliOS commented 6 years ago

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("********************************************************")
            }
            }
        }
    }
akiwarheit commented 6 years ago

Bleeding edge really bleeding for me now 😿

adjieindrawan commented 6 years ago

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

AndrejGajdos commented 6 years ago

+1

@nopedev suggestions don't work for me :/

somibuon commented 6 years ago

edit

android/build.gradle

work for me

...

allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force "com.google.android.gms:play-services-auth:11.8.0"
            }
        }
    }
}
manuTro commented 6 years ago

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

kandyjam commented 6 years ago

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.

FabioMFGaspar commented 6 years ago

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

conilas commented 6 years ago

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

kiranmehetre commented 6 years ago

Using cordova firebase plugin getting this issue. Any solution on that ????

issue

WildyDS commented 6 years ago

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

mtkopone commented 6 years ago

Well this is just great. The whole ecosystem brought down by a "+" in someones dependencies dependencies dependency.

jigaryadav commented 6 years ago

i changes all dependencies to 12.0.0 but firebase is showing an error due to internal dependencies

AndrejGajdos commented 6 years ago

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

jigaryadav commented 6 years ago

@AndrejGajdos you are right but its not a solution to change something in node_modules it work in local but not in fresh build

sagarkakad commented 6 years ago

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

isnifer commented 6 years ago

@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"
    }
}
vsreddy91 commented 6 years ago

:processDebugResources FAILED

FAILURE: Build failed with an exception. .....

[ERROR] An error occurred while running cordova run android (exit code 1).

and My project.properties file includes:

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.

my ionic project info:

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?

karthick-v-azureiken commented 6 years ago

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

jigaryadav commented 6 years ago

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'

kiranmehetre commented 6 years ago

Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

isnifer commented 6 years ago

@jigaryadav https://github.com/geektimecoil/react-native-onesignal/blob/master/android/build.gradle#L39-L41

isnifer commented 6 years ago

@Lifesoftware there are so many answers for your error

jigaryadav commented 6 years ago

@isnifer thanks man

kiranmehetre commented 6 years ago

@isnifer Which one ??????

Im trying all answers but still it is not working.

isnifer commented 6 years ago

@Lifesoftware show full debug info