Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes?

前端 未结 6 1382
刺人心
刺人心 2020-11-29 05:54

I am developing a news app but I am getting following errors in from gradle console

(androidx.core:core:1.0.1) and classes.jar (com.android.support:support-c         


        
6条回答
  •  天涯浪人
    2020-11-29 06:09

    Adding these lines to gradle.properties file solves "Duplicate Class" errors:

    android.useAndroidX=true
    
    android.enableJetifier=true
    

    However, this generated new errors in my project:

    "package android.support.annotation does not exist"

    "cannot find symbol class Fragment"

    "package android.support.v4.content does not exist"

    "Program type already present"

    etc.

    However, the refactoring worked for me:

    Migrate your project to AndroidX by selecting Refactor > 
    "Migrate to AndroidX" from the menu bar.
    
    Select Build > Clean project
    
    Restore Android Studio
    

    Now, my project (Match4app) works with AndroidX and I was able to publish it in the PlayStore without any issues.

    Comment: This task also allowed me to upgrade all other libraries that depend on AndroidX (i.e. com.firebaseui:firebase-ui-auth:6.0.2, com.google.android.gms:play-services-games:18.0.1, com.google.android.gms:play-services-auth:17.0.0, com.google.android.gms:play-services-ads:18.2.0, etc.).

提交回复
热议问题