Reputation: 2182
I know, androidx and support dependency causing multidex error We can not use androidx and android support at a same time. So I totally migrate to androidx. but one of my dependency lib used android support "lottie".
What can we do in above situation? Should I remove 'lottie' from my project.
below is my gradle
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
ext{
lottieVersion = "2.5.4"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
def androidx = "1.0.0-rc01"
api "androidx.constraintlayout:constraintlayout:1.1.2"
api "androidx.appcompat:appcompat:$androidx"
api "androidx.recyclerview:recyclerview:$androidx"
api "androidx.cardview:cardview:$androidx"
api "androidx.core:core-ktx:$androidx"
api "com.google.android.material:material:1.0.0-rc01"
implementation "com.google.code.gson:gson:2.8.5"
implementation "androidx.multidex:multidex:2.0.0"
implementation "com.airbnb.android:lottie:$lottieVersion"
}
Upvotes: 119
Views: 176554
Reputation: 7711
I was getting this error:
Caused by: com.android.builder.errors.EvalIssueException: Configuration `:app:debugRuntimeClasspath` contains AndroidX dependencies, but the `android.useAndroidX` property is not enabled, which may cause runtime issues.
I went to gradle.properties
and added the following line:
android.useAndroidX=true
Then the error is different for me:
Duplicate class android.support.customtabs.ICustomTabsCallback found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub$Proxy found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.ICustomTabsService found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.ICustomTabsService$Stub found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.ICustomTabsService$Stub$Proxy found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.IPostMessageService found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.IPostMessageService$Stub found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.customtabs.IPostMessageService$Stub$Proxy found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.3.2-runtime (androidx.core:core:1.3.2) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.3.2-runtime (androidx.core:core:1.3.2) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.3.2-runtime (androidx.core:core:1.3.2) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.3.2-runtime (androidx.core:core:1.3.2) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$CallbackHandler found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ConnectionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ConnectionCallback$ConnectionCallbackInternal found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ConnectionCallback$StubApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$CustomActionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$CustomActionResultReceiver found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ItemCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ItemCallback$StubApi23 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ItemReceiver found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImpl found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$2 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$3 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$4 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$5 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$6 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$7 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi23 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi26 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$2 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$3 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$4 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$5 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$6 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection$2 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserServiceCallbackImpl found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaItem found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaItem$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaItem$Flags found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SearchCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SearchResultReceiver found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ServiceBinderWrapper found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$Subscription found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SubscriptionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SubscriptionCallback$StubApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SubscriptionCallback$StubApi26 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21$ConnectionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21$ConnectionCallbackProxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21$MediaItem found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallbackProxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi23 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi23$ItemCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi23$ItemCallbackProxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi26 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi26$SubscriptionCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaBrowserCompatApi26$SubscriptionCallbackProxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat$Builder found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompatApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompatApi21$Builder found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompatApi23 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaDescriptionCompatApi23$Builder found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$BitmapKey found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$Builder found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$LongKey found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$RatingKey found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$TextKey found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompatApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.MediaMetadataCompatApi21$Builder found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.ParceledListSliceAdapterApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.RatingCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.RatingCompat$1 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.RatingCompat$StarStyle found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.RatingCompat$Style found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback$Stub found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback$Stub$Proxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaSession found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaSession$Stub found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.IMediaSession$Stub$Proxy found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$MessageHandler found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$StubApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$StubCompat found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerExtraData found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImpl found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21$ExtraBinderRequestResultReceiver found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21$ExtraCallback found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi23 found in modules media-1.0.0-runtime (androidx.media:media:1.0.0) and support-media-compat-28.0.0-runtime (com.android.support:support-media-compat:28.0.0)
Duplicate class androidx.browser.browseractions.BrowserActionsFallbackMenuAdapter found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class androidx.browser.browseractions.BrowserActionsFallbackMenuAdapter$ViewHolderItem found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
Duplicate class androidx.browser.browseractions.BrowserActionsFallbackMenuDialog found in modules browser-1.0.0-runtime (androidx.browser:browser:1.0.0) and customtabs-28.0.0-runtime (com.android.support:customtabs:28.0.0)
com.google.zxing.qrcode.detector.FinderPatternFinder$CenterComparator found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternFinder$FurthestFromAverageComparator found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternInfo found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.BlockPair found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.ByteMatrix found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.Encoder found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.Encoder$1 found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.MaskUtil found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.MatrixUtil found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.qrcode.encoder.QRCode found in modules core (core.jar) and core-3.3 (com.google.zxing:core:3.3.3)
Go to the documentation to learn how to Fix dependency resolution errors.
I added android.enableJetifier=true
to gradle.properties
and the errors above were gone.
Upvotes: 0
Reputation: 11
Very simple. Click on Refactor, Migrate to androidX and then follow the prompts.
Upvotes: 0
Reputation: 15705
Add the lines in the gradle.properties
file
android.useAndroidX=true
android.enableJetifier=true
If you are getting any errors while building the apk then you have to export the activities by adding android:exported="true"
tag in all activities on AndroidManifest.xml
file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.examplerealtime">
<uses-permission android:name="android.permission.INTERNET"/>
<application
...
>
<activity
android:name=".MainActivity"
...
android:exported="true">
...
</activity>
</application>
</manifest>
Upvotes: 1
Reputation: 1435
Open gradle.properties and add below two lines.
android.enableJetifier=true
android.useAndroidX=true
And you will face a new issues, here is the solution. My problem was solved after adding android:exported="true" on android.intent.category.LAUNCHER Activity
<activity
android:name=".MainActivity"
android:exported="true"> // Add this line
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Upvotes: 2
Reputation: 21
In the project folder, in build.gradle(Module:Application)
In the Refactor menu, click Migration to AndroidX to proceed with the migration.
After that, if you open gradle.properties in the Project folder, you will see the definition as below
android.enableJetifier=true
android.useAndroidX=true
Upvotes: 0
Reputation: 3409
I added below two lines in gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
then I got the following error
error: package android.support.v7.app does not exist
import android.support.v7.app.AlertDialog;
^
I have removed the imports and added below line
import static android.app.AlertDialog.*;
And the classes which are extended from AppCompactActivity, added the below line. (For these errors you just need to press alt+enter in android studio which will import the correct library for you. Like this you can resolve all the errors)
import androidx.appcompat.app.AppCompatActivity;
In your xml file if you have used any
<android.support.v7.widget.Toolbar
replace it with androidx.appcompat.widget.Toolbar
then in your java code
import androidx.appcompat.widget.Toolbar;
Upvotes: 3
Reputation: 1520
I had a problem like this before, it was the gradle.properties file doesn't exist, only the gradle.properties.txt , so i went to my project folder and i copied & pasted the gradle.properties.txt file but without .txt extension then it finally worked.
Upvotes: 0
Reputation: 19
If your project is not AndroidX (mean Appcompat) and got this error, try to downgrade dependencies versions that triggers this error, in my case play-services-location ("implementation 'com.google.android.gms:play-services-location:17.0.0'") , I solved the problem by downgrading to com.google.android.gms:play-services-location:16.0.0'
Upvotes: 0
Reputation: 640
Add the lines in the gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
Refer also
https://developer.android.com/jetpack/androidx
Upvotes: 12
Reputation: 9056
Manually adding android.useAndroidX=true
and android.enableJetifier=true
giving me hard time. Because it's throw some error or Suggestion: add 'tools:replace="android:appComponentFactory"' to <application>
To Enable Jet-fire in project there is option in android Studio
Select Your Project ---> Right Click
app----> Refactor ----> Migrate to AndroidX
Shown in below image:-
After click on Migrate to AndroidX.
It will ask for confirmation and back up for your project.
And last step it will ask you for to do refactor.
After doing Refactor check your gradle.properties have android.useAndroidX=true
and android.enableJetifier=true
. If they are not then add these two lines to your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
Note:- Upgrading using Android Studio, this option works if you have android studio 3.2 and onward. Check this
Upvotes: 64
Reputation: 11
I used these two lines of code in application tag in manifest.xml and it worked.
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
Source: https://github.com/android/android-ktx/issues/576#issuecomment-437145192
Upvotes: 1
Reputation: 139
Comment This Line in gradle.properties
android.useAndroidX=true
Upvotes: -3
Reputation: 9
API 29.+ usage AndroidX libraries. If you are using API 29.+, then you cannot remove these. If you want to remove AndroidX, then you need to remove the entire 29.+ API from your SDK:
This will work fine.
Upvotes: 1
Reputation: 59004
You need not to worry
Just enable Jetifier in your projet.
Open gradle.properties
and add below two lines.
android.enableJetifier=true
android.useAndroidX=true
It will convert all support libraries of your dependency to AndroidX at run time (you may have compile time errors, but app will run).
Upvotes: 23
Reputation: 10279
You can enable Jetifier
on your project, which will basically exchange the Android Support Library
dependencies in your project dependencies with AndroidX
-ones. (e.g. Your Lottie dependencies will be changed from Support to AnroidX)
From the Android Studio Documentation (https://developer.android.com/studio/preview/features/):
The Android Gradle plugin provides the following global flags that you can set in your gradle.properties file:
- android.useAndroidX: When set to true, this flag indicates that you want to start using AndroidX from now on. If the flag is absent, Android Studio behaves as if the flag were set to false.
- android.enableJetifier: When set to true, this flag indicates that you want to have tool support (from the Android Gradle plugin) to automatically convert existing third-party libraries as if they were written for AndroidX. If the flag is absent, Android Studio behaves as if the flag were set to false.
Precondition for Jetifier:
Android Studio 3.2
To enable jetifier, add those two lines to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
Finally, please check the release notes of AndroidX, because jetifier
has still some problems with some libraries (e.g. Dagger Android): https://developer.android.com/topic/libraries/support-library/androidx-rn
Upvotes: 161