Type androidx.appcompat.resources.R$dimen is defined multiple times

后端 未结 7 1355
轻奢々
轻奢々 2020-12-17 19:50

We have a React Native app where after upgrading to Android Studio 3.6.1 and Gradle plugin 3.6.1 we are seeing this compilation error:

Type androidx.appcompa         


        
相关标签:
7条回答
  • 2020-12-17 20:09

    I had same issue after updating gradle version to 3.6.3 from 3.5.2 in Android Studio.

    I have multiple Build Variants.

    I fixed the issue by first deleting .gradle folder from the project and did Clean Project and Rebuild Project.

    If you have multiple build variant you may have to do same thing for each one when you change build variants from one to another.

    0 讨论(0)
  • 2020-12-17 20:12

    While I was coding on the android studio on native android.Got the same problem

    Type androidx.appcompat.resources.R$dimen is defined multiple times:

    The problem is because of the Duplication of the BuildConfig which is present inside the JAVA (Generated) Directory

    Here is the solution to fix the problem.

    You have to delete the duplicate BuildConfig from the android studio by this process

    1. Click on java(generated) on the Left side

    1. The problem is extra Build Config Created

    1. When you click any of the BuildConfig, it will show the same error display in the picture

    1. Delete the extra BuildConfig and keep the original BuildConfig.

    Problem Solved

    0 讨论(0)
  • 2020-12-17 20:20

    Igor Montella's comment to my question fixed the problem - downgrade to gradle plugin 3.5.0.

    0 讨论(0)
  • 2020-12-17 20:23

    Got the same problem, just clean project and rebuild again.

    0 讨论(0)
  • 2020-12-17 20:27

    File->Invalidate Caches / Restart

    0 讨论(0)
  • 2020-12-17 20:29

    My errors were similar, with a "is defined multiple times" message.

    I solved it by downgrading the Gradle plugin to 3.5.0, running the app — or at least trying to — then upgrading to Gradle plugin 3.6.2 again.

    I am not sure why, but this seemed to have cleared some caches or dependencies I was not aware of.

    Removing ~/.gradle or android/.gradle did not help.

    0 讨论(0)
提交回复
热议问题