multiple dex files define landroid/support/annotation/AnimRes

前端 未结 18 973
太阳男子
太阳男子 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:17

    Solved this exact issue in a Cordova project that used the facebook plugin. I was able to successfully build by commenting out this line from platforms\android\project.properties, as shown:

    # cordova.system.library.1=com.android.support:support-v4:+
    

    And by commenting out this line from platforms\android\build.gradle, as shown:

    // compile "com.android.support:support-v4:+"
    

    Then doing the build. The problem started when I installed (katzer/cordova-plugin-local-notifications) which added these lines, but it created a conflict since the library it was adding to the build was already part of the facebook plugin build.

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

    Another reason that messages such as these can come up in Android Studio when building and launching can be the cause of application tags in your libraries.

    If you have several Android Library projects that you imported as modules. Go into those projects and remove the <application> ... </application> tags and everything between them. These can cause issues in the build process along with the support library issues already mentioned.

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

    If you import AppCompat as a library project and you also have android-support-annotations.jar in libs elsewhere, make sure to import everywhere AppCompat library only (it already includes this annotations lib). Then delete all android-support-annotations.jar to avoid merging multiple versions of this library.

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

    From /platforms/android/libs/ delete android-support-v4.jar. It works for me.

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

    I managed to fix this issue. The reason was that I included the android support library 19.0.0 as a dependency, but 19.1.0 is required. See here for more information

    So it has to be

    dependencies {
        compile 'com.android.support:support-v4:19.1.0'
        compile 'com.crashlytics.android:crashlytics:1.+'
        compile 'com.android.support:support-annotations:20.0.0'
    }
    
    0 讨论(0)
  • 2020-11-28 08:26

    For me the reason was the new data-binding lib

    com.android.databinding:dataBinder:1.0-rc2
    

    it somehow used a conflicting version of the annotations lib, which I could not force with

    configurations.all {
        resolutionStrategy {
            force group: 'com.android.support', name: 'support-v4', version: '23.1.0'
            force group: 'com.android.support', name: 'appcompat-v7', version: '23.1.0'
            force group: 'com.android.support', name: 'support-annotations', version: '23.1.0'
        }
    }
    

    but the new rc3 and rc4 versions seem to have fixed it, so just use those versions

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