错误:程序类型已存在:android.support.v4.app.INotificationSideChannel $ Stub

时间:2019-09-15 10:15:51

标签: android android-studio android-gradle-plugin build.gradle androidx

我已将Firebase数据库集成到我的Android应用程序中,并出现以下错误:

Error:Program type already present: android.support.v4.app.INotificationSideChannel$Stub

您可以如下检查我的gradle文件:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.bestofapps.task.mycuteapp"
            minSdkVersion 16
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        dataBinding {
            enabled = true
        }
        compileOptions {
            targetCompatibility 1.8
            sourceCompatibility 1.8
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation pri.support.appcompat
        implementation pri.support.design
        implementation pri.support.cardview
        implementation pri.support.recyclerview
        implementation pri.support.constraint

        //Lifecycle
        implementation "android.arch.lifecycle:extensions:1.1.1"
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

        //Firebase

        //noinspection GradleCompatible
        implementation 'com.google.firebase:firebase-database:19.1.0'
        implementation 'com.google.firebase:firebase-config:19.0.1'
        implementation 'com.google.firebase:firebase-core:17.2.0'
        implementation 'com.google.firebase:firebase-messaging:20.0.0'
        implementation 'com.google.firebase:firebase-analytics:17.2.0'
        implementation 'com.android.support:multidex:1.0.3'


        implementation("com.github.bumptech.glide:glide:4.8.0@aar") {
            transitive = true
        }
        // Glide v4
        annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

        //Google Map
        implementation 'com.google.android.gms:play-services-maps:15.0.1'

        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    apply plugin: 'com.google.gms.google-services'


You can also check my build.gradle file as below : (Project Level)

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

buildscript {

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

我还在AndroidManifest.xml文件中指定了所需的Internet权限:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission. ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

您可以检查上述所有内容是否正确,但会收到相同的错误。还可以通过更改compileSDKVersion和targetSDKVersion进行检查。

我还在build.gradle文件中指定了以下两点:

android.useAndroidX = true
android.enableJetifier = false

请指导。

可能是什么问题?

0 个答案:

没有答案