错误:在项目“应用”中,已解析的Google Play服务库依赖项依赖于另一个版本的确切版本,同时集成了一个信号

时间:2019-12-01 17:34:12

标签: java android gradle

我试图在我的应用程序中实现oneSignal,但出现错误提示

  

错误:在项目“应用”中,已解析的Google Play服务库依赖项依赖于另一个版本(例如“ [10.2]”)。   1,16.0.99]”,但尚未解决该版本。该库显示的行为将是未知的。

     

依赖性失败:com.onesignal:OneSignal:3.12.3-> com.google.android.gms:play-services-location @ [10.2.1,16.0.99],b   ut play-services-location版本为15.0.1。

     

以下依赖项是直接的项目依赖项,或者具有导致该领域的传递性依赖项   问题。   -项目“应用”取决于com.google.android.gms:play-services-location @ {严格地15.0.1}   -项目“应用”取决于com.onesignal:OneSignal @ {严格地为3.12.3}

     

有关扩展的调试信息,请从命令行使用./gradlew --info:app:assembleDebug执行Gradle以查看dep   文物的优先路径。此错误消息来自google-services Gradle插件,请在https://上报告问题   github.com/google/play-services-plugins并通过向您的b添加“ googleServices {disableVersionCheck = false}”来禁用   uild.gradle文件。

这是我的毕业班


    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 个答案:

答案 0 :(得分:3)

我在这里的Kotlin项目中遇到了同样的问题,解决方案是在模块的build.gradle文件中添加implementation 'androidx.fragment:fragment-ktx:1.2.2'依赖项。

答案 1 :(得分:1)

我已经解决了问题。

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

只需将这些代码放在顶部并进行同步

答案 2 :(得分:0)

对于使用反应本机版本0.60或更高版本的用户,一个信号与interfire防火墙模块会出现相同的问题。如上述@last gg帖子

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'

复制您的android/app/build.gradle文件的最顶部。然后重建您的android应用。

答案 3 :(得分:0)

这对我有用

//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]'

}