DexArchiveBuilderException

2019-06-02 19:26发布

I know that this question is already asked but the solutions provided there are not working for me and i can't risk the build with d8 compiler. Here is the error:

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing Services/MyFirebaseInstanceIDService.class
Error:com.android.dx.cf.iface.ParseException: class name (services/MyFirebaseInstanceIDService) does not match path (Services/MyFirebaseInstanceIDService.class)

Gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ops.com.imagefetcher"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}


apply plugin: 'com.google.gms.google-services'

Please help me to fix this issue.

Edit: While trying to fix it I did "clean project" and one more error came out:

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug

3条回答
Fickle 薄情
2楼-- · 2019-06-02 19:48

After doing clean build i got error:

execution failed for task ':app:clean'.
> Unable to delete directory: E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug

Then I tried to delete the package manually from android studio but it showed some IOException error. Then what i did is: I closed the android studio and manually deleted the debug folder from "MyComputer/ThisPC" by following the path from error. After this fix, android studio successfully created the build.

查看更多
劫难
3楼-- · 2019-06-02 19:48

The casing in your path doesn't match:

services/MyFirebaseInstanceIDService

Services/MyFirebaseInstanceIDService.class

查看更多
相关推荐>>
4楼-- · 2019-06-02 20:09

in gradle

android {
    compileSdkVersion 26
    defaultConfig {
        multiDexEnabled true
    }
}
查看更多
登录 后发表回答