Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes?
- 取得連結
- X
- 電子郵件
- 其他應用程式
You can add below 2 lines into your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
Note to check, to not repeat any line that already exists (and ensure existing are
true).
Details:
Your project (or one of its sub-projects, or a dependency) is no longer using android.support libraries and instead is using androidx libraries, which causes conflicts if mixed with android.support libraries.
If you want to use androidx-namespaced libraries in an old project, you need to set the compile SDK to Android 9.0 (API level 28) or higher but below "API level 31", and set both of the mentioned Android Gradle plugin flags to true.
android.useAndroidX: When this flag is set to true, the Android plugin uses the appropriate AndroidX library instead of a Support Library. The flag is false by default if it is not specified.
android.enableJetifier: When this flag is set to true, the Android plugin automatically migrates existing third-party libraries to use AndroidX dependencies by rewriting their binaries. The flag is false by default if it is not specified.
- 取得連結
- X
- 電子郵件
- 其他應用程式
android.support.*withandroidx.*dependencies (but for me, it just resulted in a compile error becauseandroid.supportwas used in the codes), in case anyone is seeking a fix instead of a workaround check the answer for Execution failed for task ':app:checkDebugDuplicateClasses' (although that question is about Ionic the answer should work).