Firebase核心依存关系:程序类型已存在:android.support.v4.app.INotificationSideChannel

时间:2019-01-11 12:30:36

标签: android firebase build.gradle

在我的项目中包含Firebase核心依赖项

implementation 'com.google.firebase:firebase-core:15.0.2'

我收到此错误。

  

程序类型已经存在:   android.support.v4.app.INotificationSideChannel消息{kind = ERROR,   text =程序类型已经存在:   android.support.v4.app.INotificationSideChannel,来源= [未知   源文件],工具名称= Optional.of(D8)}

我经历了一些类似的问题,但似乎都无法解决我的错误。

这是我的应用级别build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"
    defaultConfig {
        applicationId "com.example.chandranichatterjee.appname"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    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.0.0-alpha1'
    //implementation 'com.google.firebase:firebase-core:11.2.0'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
}
apply plugin: 'com.google.gms.google-services'

以下是我的项目级别build.gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        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
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我还在gradle.properties中添加了以下几行:

android.useAndroidX=true
android.enableJetifier=true

感谢您的帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

1。

classpath 'com.android.tools.build:gradle:3.1.0'

==>

classpath 'com.android.tools.build:gradle:3.2.0'

https://developer.android.com/studio/releases/gradle-plugin

Plugin version, Required Gradle version
3.2.0 - 3.2.1 , 4.6+ 
3.3.0 - 3.3.2 , 4.10.1+
3.4.0+        , 5.1.1+
  1. 添加gradle.properties
android.useAndroidX=true
android.enableJetifier=true