添加firebase广告依赖项时,在gradle中出错

时间:2018-06-06 10:22:43

标签: android firebase android-studio android-gradle build.gradle

在我添加了firebase ads依赖项实施后,com.google.firebase:firebase-ads:15.0.1' 现在我得到了以下错误:



Error:The library com.google.firebase:firebase-analytics is being requested by various other libraries at [[15.0.1,16.0.0), [16.0.0,16.0.0], [16.0.0,99999]], but resolves to 16.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.



 但我还没有添加分析依赖,因为我不需要它,但无论如何我添加它来看天气它解决了问题,但我仍然得到同样的错误 以下是我的build.gradle(模块应用程序)



//noinspection GradleCompatible
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.rimapps.midippu"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    //noinspection GradleDynamicVersion
    implementation 'com.android.support:cardview-v7:26.1.0+'
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-core:16.0.0'
    apply plugin: 'com.google.gms.google-services'
    implementation'com.google.firebase:firebase-analytics:16.0.0'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

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



 有什么我可以做的吗?

1 个答案:

答案 0 :(得分:1)

在我的项目gradle中将classpath依赖项更新为classpath'com.google.gms:google-services:4.0.1'之后,它工作了