duplicate entry: com/android/volley/AuthFailureError.class while compiling project in android studio

前端 未结 9 1932
长情又很酷
长情又很酷 2020-12-02 00:01

I am using external libraries payu money sdk and linkedin-sdk, both uses volley libraries, which while compiling project gives duplicate entry of AuthFailureError.class

相关标签:
9条回答
  • 2020-12-02 00:13

    Add multiDexEnabled true in the defaultConfig section of your gradle file

    Then,

    compile 'com.android.support:multidex:1.0.1' in your dependencies

    Finally add below in your application class:

     @Override
        protected void attachBaseContext(Context base) {
            super.attachBaseContext(base);
            MultiDex.install(this);
        }
    

    Also, check if you are using volley.jar in your libs folder. If so, delete that jar file, and compile again. Sometimes, jar dependencies conflicts with those compiled using remote source.

    0 讨论(0)
  • 2020-12-02 00:14

    I stumbled upon this same error, and after reading this, I was able to solve it.

    Try adding this line inside your app dir build.gradle file -

    android{
    configurations {
        all*.exclude group: 'com.android.volley'
    }}
    

    Hope this helps.

    0 讨论(0)
  • 2020-12-02 00:17

    Just remove your volley library from dependancy. Try clean and rebuild project it works for me. Ex. payusdk are also implementing volley library so that is the reason exception shows duplicate entry. I hope it works. because i also found this error and i do these things it works. Thanks.

    0 讨论(0)
  • 2020-12-02 00:23

    Okay I got my answer

    On mac instead of control n, it is command 0 and the command i needed was

    configurations { all*.exclude module: 'volley-release' }

    0 讨论(0)
  • 2020-12-02 00:25

    just remove the duplicate jar file(note:use new version,delete old version) for importing "com.android.volley.AuthFailureError" in build.gradle. Then clean project and rebuild project and then run you will get result.

    0 讨论(0)
  • 2020-12-02 00:27

    Use the below command in Android studio terminal to get the dependency conflict data - [Replace with your app Name]

    ./gradlew -q :<app>:dependencyInsight --dependency volley --configuration compile
    

    If you are using latest Volley library from android [https://github.com/google/volley/releases], add below two lines in your build.gradle file under each of the compile library entries that has conflict.

    Ex:

    compile('com.xyz:abc:1.1.0-RELEASE') {
            exclude module: 'library'
            exclude group: 'com.mcxiaoke.volley'
    }
    
    0 讨论(0)
提交回复
热议问题