Program type already exists: android.support.v4.app.inootificationsidechannel $stub $proxy

I know it may look like this question, but I can't solve the solution it proposes, and I can't comment on it. The error is:

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

I'm trying to create an application using firebase. This is my gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
    minSdkVersion 27
    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'
    }
}
aaptOptions {
    noCompress "tflite"
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0-rc01'

// ML Kit dependencies
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-ml-vision:17.0.0'
}
apply plugin: 'com.google.gms.google-services'

I pass each file to ensure that the import is good, and I also add

android.useandroidX = true
android.enableJetifier = false

There are my project gradle files:

// 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.4'
    classpath 'com.google.gms:google-services:4.1.0'


    // 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
}

I use Android studio 3.1.4

resolvent:

This happened when I tried to migrate to Android X. The reason behind this is that not all libraries have been migrated to Android X

>You can manually delete dependencies.: try to view all dependencies and find conflicting dependencies. You can use the gradle view plug-in of Android studio or use class navigation in the menu (in Android Studio: navigation – > class; now a search box appears and check 'include non project items'; paste the whole class name, create an error and search immediately; find the class with this dependency and delete it manually!). Please check whether there are any import statements in the file using non andoirdx dependencies. If so, delete them

or

>In Android studio, refractor – > is migrated to Android X

Or (manual mode)

>Add the following to gradle. Properties

   android.useandroidX=true
   android.enableJetifier=true

This allows Android studio to migrate all dependencies. For more information, see here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>