Narendra Pal
Narendra Pal

Reputation: 6604

Error while building application on Android Studio

I am new on Android Studio. I am facing below mentioned error while building the project.

:app:shrinkDebugMultiDexComponents FAILED
    Error:Execution failed for task ':app:shrinkDebugMultiDexComponents'.
    > java.io.IOException: Can't read [D:\StudioWorkspace\SampleSDKDemoProject\app\build\intermediates\multi-dex\debug\allclasses.jar] (Can't process class [org/fmod/FMODAudioDevice.class] (256))

Here is my build.gradle file inside app folder.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'

    defaultConfig {
        applicationId "com.test.offerwall"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    compile 'com.bee7.gamewall.aar:bee7@aar'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-base:6.5.87'
    compile 'com.test.android.ads.aar:myapp@aar'
    compile 'com.google.android.gms:play-services:7.5.0'
}
repositories {
    flatDir {
        dirs 'libs'
    }
}

I have updated the android sdk also but no luck. Could you guys help me out that why I am facing this issue.

Kindly help me out with the solution.

Thanks in advance.

As commented: I have tried using removing the multiDexEnabled true Then I got this error.

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
    at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
    at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
    at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' finished with non-zero exit value 2

Upvotes: 1

Views: 3709

Answers (1)

Ahmad Al-Sanie
Ahmad Al-Sanie

Reputation: 3785

For the first error remove multiDexEnabled true.

UNEXPECTED TOP-LEVEL EXCEPTION:

for this one remove one of your com.google.android.gms:play-services libraries it is included more than once.

or add this in your build.gradle at the root level:

configurations {
    all*.exclude group: 'com.google.android.gms', module: 'play-services'
}

hope this will help.

Upvotes: 2

Related Questions