multiple dex files define landroid/support/annotation/AnimRes

前端 未结 18 974
太阳男子
太阳男子 2020-11-28 08:00

The moment I added the android support annotations to my dependencies

compile \'com.android.support:support-annotations:20.0.0\'

I got this erro

相关标签:
18条回答
  • 2020-11-28 08:37

    In my case I had a file called cache.xml under /build/intermediates/dex-cache/cache.xml in the root project folder. I deleted this file, rebuild the project and it worked for me.

    0 讨论(0)
  • 2020-11-28 08:37

    I deleted the android-support-v4.jar and it worked.

    Explain - android-support-v4.jar is conflicting with my other .jar files of project\libs files ** specially when you are running with java 8 on AS.

    0 讨论(0)
  • 2020-11-28 08:39

    The problem is that android-support-annotations.jar used to be a separate library containing the android annotations, but for some reason these annotations are already included in recent versions of the android-support-v4.jar file.

    Deleting the annotations jar solved the issue.

    0 讨论(0)
  • 2020-11-28 08:41

    I deleted the android-support-v4.jar and it worked.

    0 讨论(0)
  • 2020-11-28 08:42

    Build->clean Project ,and it worked

    0 讨论(0)
  • 2020-11-28 08:42

    As other users said, the first elements to troubleshoot are dependencies. Although, sometimes you can struggle for hours and you don't find any problem so you can focus on the build process instead.

    Changing the way in which the .dex files are produced sometimes solves the problem. You can go through these steps:

    • Open your Build.gradle (app) file
    • Search for the task dexOptions
    • Change it to:

      dexOptions {
        incremental false 
      }
      

    If you don't find the task in your file then you can add it.

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