4
votes

I tried to implement oneSignal into my apps but I got error that said

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2. 1, 16.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.onesignal:OneSignal:3.12.3 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b ut play-services-location version was 15.0.1.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue. -- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 15.0.1} -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.3}

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:// github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b uild.gradle file.

here is my gradle class


    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'

    buildscript {
        repositories {
            maven { url 'https://plugins.gradle.org/m2/'}
        }
        dependencies {
            classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
        }
    }
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

    repositories {
        maven { url 'https://maven.google.com' }
    }


    android {
        compileSdkVersion 29
        buildToolsVersion "29.0.2"
        defaultConfig {
            applicationId "com.example.gerobokgo"
            minSdkVersion 26
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.Test.runner.AndroidJUnitRunner"
            manifestPlaceholders = [
                    onesignal_app_id: '560003c8-bceb-4896-bf78-435948f4fc6d',
                    // Project number pulled from dashboard, local value is ignored.
                    onesignal_google_project_number: 'REMOTE'
            ]
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.firebase:firebase-auth:16.0.5'
        implementation 'com.google.firebase:firebase-database:16.0.4'
        implementation 'com.google.firebase:firebase-core:16.0.8'
        implementation 'com.firebaseui:firebase-ui-database:4.3.2'
        implementation 'com.google.firebase:firebase-storage:16.0.4'

        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'

        implementation 'com.squareup.picasso:picasso:2.5.2'
        //Layout
        implementation 'com.google.android.material:material:1.0.0'
        //recylervieer
        implementation 'androidx.recyclerview:recyclerview:1.0.0'

        // image slider
        implementation 'com.github.therealshabi:AutoImageFlipper:v1.4.1'

        //image Cropper
        implementation 'com.theartofdev.edmodo:android-image-cropper:2.1.+'
        implementation 'androidx.work:work-runtime:2.2.0'

        implementation 'com.braintreepayments:card-form:3.1.1'


        //onesignal
        implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
    }


4

4 Answers

3
votes

I had the same problem in a Kotlin project here, the solution was to add implementation 'androidx.fragment:fragment-ktx:1.2.2' dependency to my module's build.gradle file.

2
votes

I have solved the problems.

        repositories {
            maven { url 'https://plugins.gradle.org/m2/'}
        }
        dependencies {
            classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
        }
    }
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

    repositories {
        maven { url 'https://maven.google.com' }
    }

just put these code on the top and sync it

0
votes

For those who are using react-native version 0.60 or above one signal and intervase firebase module makes same problem. As @last gg post above,

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal 
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

copy this very top of your android/app/build.gradle file. Then rebuild your android app.

0
votes

This Worked For Me

//Add One Signal Plugin At the TOP before Google GSM Plugin

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' 
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' 

//Add this after Plugin

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    }
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        android {
            defaultConfig {
                manifestPlaceholders = [onesignal_app_id               : "******************",
                                        // Project number pulled from dashboard, local value is ignored.
                                        onesignal_google_project_number: "**************"]
            }
        }
    }
    repositories {
        mavenCentral()
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions{
        checkReleaseBuilds false
        abortOnError false
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'


    //Firebase Dependancy
    implementation 'com.google.firebase:firebase-analytics:17.4.1'

    //Onesignal Dependancy
    implementation 'com.onesignal:OneSignal:[3.6.5, 3.99.99]'

}