Google Material Design Library Error Program Type Already Present: Android.Support.V4.App.Inotificationsidechannel$Stub$Proxy

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

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.

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

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

  • You may manually remove dependencies. : Try to see all dependencies and find out the conflicting one. You may use Gradle View plugin for Android Studio or use class navigation from menu. (In android Studio: Navigation -> class; Now a search box appears and tick 'include non project items'; paste the whole class name creating error and search now; Find out the class having this dependency and remove manually!). Please check if you have any import statements left in files which uses the non AndoirdX dependencies still. If yes, please remove them too.

or

  • In Android studio, Refractor -> Migrate to AndroidX.

or alternatively(manual way)

  • add following to gradle.properties .
   android.useAndroidX=true
android.enableJetifier=true

This makes Android Studio to migrate all dependencies. For more info please check here



Related Topics



Leave a reply



Submit