React-native-onesignal: play-services-basement requested by various other libraries

Created on 4 Jul 2018  ·  1Comment  ·  Source: OneSignal/react-native-onesignal

Description:

I've been trying to run my app for a few hours now, and I'm having the following issue:

> Configure project :react-native-onesignal
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :react-native-onesignal:compileDebugAidl FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture snapshot of input files for task ':react-native-onesignal:compileDebugAidl' property 'importDirs' during up-to-date check.
> The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 12.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
16 actionable tasks: 15 executed, 1 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
✨  Done in 8.26s.

Environment

  1. What version of the OneSignal React-Native SDK are you using: 3.2.5
  2. How did you add the SDK to your project: yarn

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

ext {
    googlePlayServicesVersion   = "15.0.0"
}

allprojects {
    repositories {
        mavenLocal()
        maven { url 'http://maven.google.com' }
        jcenter { url "http://jcenter.bintray.com/" }
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

app/build.gradle:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(':react-native-config')
    implementation project(':react-native-device-info')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-onesignal')
    implementation(project(":react-native-google-signin")) {         
        exclude group: "com.google.android.gms"
    }

    implementation "com.android.support:appcompat-v7:27.0.2"
    implementation "com.android.support:multidex:1.0.3"
    implementation "com.facebook.react:react-native:+"
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.1"
}

Steps to Reproduce Issue:

  1. Add react-native-onesignal to your project
  2. Follow the setup
  3. Try to build the app for Android

Most helpful comment

Updated my build.gradle with this fixed it

ext {
    googlePlayServicesVersion   = "15.0.1"
}

allprojects {
    repositories {
        mavenLocal()
        maven { url 'http://maven.google.com' }
        jcenter { url "http://jcenter.bintray.com/" }
        google()
        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-basement:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-tasks:$googlePlayServicesVersion"
            }
        }
    }
}

>All comments

Updated my build.gradle with this fixed it

ext {
    googlePlayServicesVersion   = "15.0.1"
}

allprojects {
    repositories {
        mavenLocal()
        maven { url 'http://maven.google.com' }
        jcenter { url "http://jcenter.bintray.com/" }
        google()
        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-basement:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-tasks:$googlePlayServicesVersion"
            }
        }
    }
}
Was this page helpful?
0 / 5 - 0 ratings