Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google material design library error Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

Whenever i add implemntation 'com.google.android.material:material:1.0.0-alpha1' when i try to build my project Android Studio says:

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

This is my gradle script:

    apply plugin: 'com.android.application'  android {     compileSdkVersion 'android-P'     defaultConfig {         applicationId "it.smart.bab3"         minSdkVersion 21         targetSdkVersion 'p'         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])     implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'     implementation 'com.google.android.material:material:1.0.0-alpha1'     implementation 'com.android.support.constraint:constraint-layout:1.1.0'     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.android.support:design:28.0.0-alpha1'     implementation 'com.android.support:support-v4:28.0.0-alpha1' } 

I'm new ith this type of errors, and i didn't find anithing with this error. Thanks

like image 244
Smart Avatar asked May 11 '18 09:05

Smart


1 Answers

I've been struggling all day with this issue too. Finally I managed to compile and run the project successfully.

First of all, get rid of this:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' implementation 'com.android.support:design:28.0.0-alpha1' implementation 'com.android.support:support-v4:28.0.0-alpha1' 

Add the following in your gradle.properties file:

android.useAndroidX = true android.enableJetifier = false 

And finally, sync the project and then compile.

If it doesn't work, clean the project and then rebuild.

PS: I can't get targetSdkVersion 'p' to work. My build.gradle file end up as follows:

apply plugin: 'com.android.application'  android {     compileSdkVersion 'android-P'     defaultConfig {         applicationId "com.github.alvarosct02.demo"         minSdkVersion 19         targetSdkVersion 27         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])      implementation 'com.google.android.material:material:1.0.0-alpha1'     implementation 'com.android.support.constraint:constraint-layout:1.1.0'      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'  } 

Hope it works for you too.

like image 99
Alvaro Santa Cruz Avatar answered Sep 25 '22 01:09

Alvaro Santa Cruz