前にAndroid update 3.4アプリケーションは完全に実行されますが、アップグレード後にAndroidアプリケーションにマージエラーが発生します:
"Duplicate class Android.support.v4.app.INotificationSideChannel"
Android update 3.4
upgrade gradle 5.1.1
upgrade sdk
Error:
Duplicate class Android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class Android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class androidx.core.internal.package-info found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.Android.support:support-compat:28.0.0)
Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.NonParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelUtils found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$InputBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.Android.support:versionedparcelable:28.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
- - - - - - - - - 依存 - - - - - -
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.Android.support:appcompat-v7:28.0.0'
implementation 'com.Android.support:design:28.0.0'
//noinspection GradleCompatible
// implementation 'com.Android.support:appcompat-v7:28.0.0'
implementation 'com.Android.support:support-compat:28.0.0'
implementation 'com.Android.support.constraint:constraint-layout:2.0.0-alpha4'
// implementation 'com.Android.support:design:28.0.0'
testImplementation 'junit:junit:4.13-beta-2'
androidTestImplementation 'com.Android.support.test:runner:1.0.2'
androidTestImplementation 'com.Android.support.test.espresso:espresso-core:3.0.2'
//volley
implementation 'com.Android.volley:volley:1.1.0'
//crop image library...
implementation 'com.theartofdev.edmodo:Android-image-cropper:2.8.0'
//ButterKnife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.github.traex.rippleeffect:library:1.3'
//Google play services
implementation 'com.google.Android.gms:play-services-location:16.0.0'
implementation 'com.google.Android.gms:play-services-maps:16.1.0'
//gson
implementation 'com.google.code.gson:gson:2.8.5'
// Room
implementation 'Android.Arch.persistence.room:runtime:1.1.1'
implementation 'com.Android.support:support-v4:28.0.0'
annotationProcessor "Android.Arch.persistence.room:compiler:1.1.1"
implementation 'org.jsoup:jsoup:1.11.3'
//cardview & recyclerview
implementation 'com.Android.support:cardview-v7:28.0.0'
implementation 'com.Android.support:recyclerview-v7:28.0.0'
//picasoo
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.Android.support:support-annotations:28.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.karumi:dexter:5.0.0'
implementation 'com.journeyapps:zxing-Android-embedded:3.4.0'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-ml-vision:19.0.3'
//firebase-cloud massaging..
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
アップグレード後、androidx.core:core
は、プロジェクトがまだandroidxを使用していないときにどこかにアクセスされます。そのため、INotificationSideChannel
などのクラスと他の多くのクラスが2か所で見つかりました-androidx.core:core
およびcom.Android.support:support-compat
。このため、このエラーが発生しました。
AndroidXに移行する必要があります。 AndroidXについて知らない場合。お読みください AndroidXとは?
Android Studio 3.2(September 2018))には、既存のプロジェクトをAndroidX
に移行する直接オプションがあります。これにより、すべてのパッケージが自動的に屈折します。
移行する前に、プロジェクトをバックアップすることを強くお勧めします。
既存のプロジェクト
新たなプロジェクト
これらのフラグをgradle.properties
Android.enableJetifier=true
Android.useAndroidX=true
@ ライブラリのマッピングでAndroidXパッケージが等しいかどうかを確認してください。
@ Migrate to AndroidX の公式ページを確認してください
androidx
ライブラリと競合するsupport
ライブラリ(おそらく使用されているライブラリの1つ)があります。
これらの行をgradle.properties
ファイルに追加します(プロジェクトのルートディレクトリにあります)。
Android.useAndroidX=true
Android.enableJetifier=true
Jetifierツールは、サポートライブラリに依存するライブラリを移行して、代わりに同等のAndroidXパッケージに依存します。