1
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/androidquery/util/Constants;

I have followed every stackoverflow question on this but none of it solved my problem.I am still getting the error.

Unable to execute dex: Multiple dex files define

Android Studio Gradle Error: Multiple dex files define

Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

//apply plugin: 'com.android.library'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId "com.andromeda.kunalbhatia.demo.hungamaplayer"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.exoplayer:exoplayer:r1.5.8'
    compile 'com.android.support:mediarouter-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.googlecode.android-query:android-query:0.25.9'
}

3 Answers3

1

It's possible that you use two lib that inside use the same transitive dependencies.

Review your dependencies on build.gradle, and use exclude tag for not repeat dependencies. (You should update the post adding your dependencies)

Óscar
  • 809
  • 1
  • 8
  • 33
0

try by adding

multiDexEnabled true 

in defautconfig{} in gradle

jigar savaliya
  • 474
  • 1
  • 8
  • 21
0

Try run this command in your project root directory> ./gradlew androiddependencies
If you find library 'android-query' occurs two times with different versions, you can fix your project's dependency to avoid this problem.

banking
  • 480
  • 2
  • 9