首页 > 解决方案 > 程序类型已存在:android.support.v4.app.INotificationSideChannel$Stub

问题描述

我收到以下错误,我无法修复它

Program type already present: android.support.v4.app.INotificationSideChannel$Stub
Message{kind=ERROR, text=Program type already present: android.support.v4.app.INotificationSideChannel$Stub, sources=[Unknown source file], tool name=Optional.of(D8)}

这是我的gradle文件

apply plugin: 'com.android.application'

apply plugin: 'com.google.gms.google-services'
android {
    android.packagingOptions {
        exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
        exclude 'META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version'
        exclude 'META-INF/androidx.cursoradapter_cursoradapter.version'
        exclude 'META-INF/androidx.drawerlayout_drawerlayout.version'
        exclude 'META-INF/androidx.print_print.version'
        exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
        exclude 'META-INF/androidx.interpolator_interpolator.version'
        exclude 'META-INF/androidx.fragment_fragment.version'
        exclude 'META-INF/androidx.customview_customview.version'
        exclude 'META-INF/androidx.documentfile_documentfile.version'
        exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
        exclude 'META-INF/androidx.loader_loader.version'
        exclude 'META-INF/androidx.viewpager_viewpager.version'
        exclude 'META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version'
        exclude 'META-INF/androidx.core_core.version'
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/androidx.slidingpanelayout_slidingpanelayout.version'
        exclude 'META-INF/androidx.coordinatorlayout_coordinatorlayout.version'
        exclude 'META-INF/androidx.legacy_legacy-support-core-ui.version'
    }
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.example.keshav.fbasetest"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }


    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE.md'
        exclude 'META-INF/LICENSE-notice.md'
    }
    dexOptions {
        preDexLibraries = false
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-database:18.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    api 'com.firebaseui:firebase-ui-database:3.2.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.firebase:firebase-storage:18.1.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'
    implementation 'com.squareup.picasso:picasso:2.71828'


    }

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

我尝试查看先前的解决方案并实施它们,但它们没有奏效。我还尝试将 android.useAndroidX=true android.enableJetifier=false 添加到我的 gradle.properties 但代码仍然出现此错误。任何帮助将不胜感激。

标签: androidfirebasefirebase-realtime-databaseandroid-gradle-plugin

解决方案


根据 Gabriele 所说,迁移到 androidx 解决了问题


推荐阅读