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

时间:2019-08-07 18:56:31

标签: android firebase firebase-realtime-database android-gradle-plugin

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

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而言,但代码仍给出此错误。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

按照Gabriele所说,迁移到androidx可以解决问题