After upgrade android version getting “Duplicate class android.support.v4.app.INotificationSideChannel”

后端 未结 3 869
无人及你
无人及你 2020-12-15 07:24

before android update 3.4 my application run perfectly but after upgrade android my application getting merging error:

\"Duplicate class android.support.v4.         


        
3条回答
  •  鱼传尺愫
    2020-12-15 07:46

    Why did this happen?

    Because after upgrade, androidx.core:core is accessed somewhere, when your project is still not using androidx. So classes like INotificationSideChannel and many others are now found at two places - androidx.core:core and com.android.support:support-compat. That's why this error occured.

    Solution?

    You need to migrate to AndroidX which you should have done already. If you don't know about AndroidX. Please read What is AndroidX?

    How to migrate current project

    In Android Studio 3.2 (September 2018), there is direct option to migrate existing project to AndroidX. This refract all packages automatically.

    Before you migrate, it is strongly recommended to backup your project.

    Existing project

    • Android Studio > Refactor Menu > Migrate to AndroidX...
    • It will analysis and will open Refractor window in bottom. Accept changes to be done.

    New project

    Put these flags in your gradle.properties

    android.enableJetifier=true
    android.useAndroidX=true
    

    Check @Library mappings for equal AndroidX package.

    Check @Official page of Migrate to AndroidX

提交回复
热议问题