1

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
4
  • Have you tried Cleaning and Rebuilding your project? Sometimes you might need to delete the apk from your phone or emulator as well. Could also result from a gradle dependency mismatch or using different versions of the same dependency. Do you have a larger stacktrace Commented Feb 15, 2018 at 8:41
  • Yes i have already tried that and there is no installed apk in the emulator.
    – sak
    Commented Feb 15, 2018 at 8:42
  • Ensure you are in the package not Android view mode on the file tree on the left side. Press Alt+1 if it is not open. Go to the app\build folder as stated and delete the build folder`. Dont worry, once you clean and rebuild it should regenerate all the files Commented Feb 15, 2018 at 8:46
  • some java.io.IOException while trying to delete build folder
    – sak
    Commented Feb 15, 2018 at 8:52

3 Answers 3

7

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.

0
2

The casing in your path doesn't match:

services/MyFirebaseInstanceIDService

Services/MyFirebaseInstanceIDService.class

1

in gradle

android {
    compileSdkVersion 26
    defaultConfig {
        multiDexEnabled true
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.