Failed to crunch file - Android studio (app:mergeDebugResources)

35,020

Solution 1

Failed to crunch file means studio can't process the file. Its too long and it has reached the max file path line of the operating system.

-> Crude way to solve it is move the project to some folder in "C:\".

-> Better way is to change the build directory of the project in the build.gradle file (Project)

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    .
    .
}

Solution 2

this is because your project path is too long. Please make this as short as possible. It will resolve this error.

Like

C:\Users\marschall\Desktop\googlesamples-android-play-location-2ed2964\ActivityProject

to

C:\ActivityProject

Solution 3

The length of the path\file name (the count of all characters in the name)has crossed the maximum limit. This is happening because a combination of length of file name and the multiple nested folder levels.

Solution 4

It's because the path length has exceeded the maximum value. You do not have to move your project elsewhere. Just open a shell in the root directory of your hard drive and make a junction to your project:

D:\a\very\long\path\to\your\project

cd \ mklink /j project D:\a\very\long\path\to\your\project cd project You can now make the building process without a pain

Solution 5

This is happening because file name and path is too long

1) rename the folder to a shorter name

2) move the project to the folder to a simple path like

c:/android projects/Project Sample

Share:
35,020

Related videos on Youtube

Tobias Marschall
Author by

Tobias Marschall

Software developer and founder at http://appella.app & CS student at LMU Munich. In love with dope looking animated UIs and fascinated by space travel. 🚀

Updated on July 09, 2022

Comments

  • Tobias Marschall
    Tobias Marschall almost 2 years

    i am currentyl trying to implement Google ActivityRecognitionApi. However i get following errors:

    Error:Failed to crunch file C:\Users\marschall\Desktop\googlesamples-android-play-location-2ed2964\ActivityProject\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-cast-framework\10.0.1\res\drawable-xxhdpi-v4\quantum_ic_forward_30_grey600_36.png into C:\Users\marschall\Desktop\googlesamples-android-play-location-2ed2964\ActivityProject\app\build\intermediates\res\merged\debug\drawable-xxhdpi-v4\quantum_ic_forward_30_grey600_36.png

    Error:Execution failed for task ':app:mergeDebugResources'. Error: Failed to crunch file C:\Users\marschall\Desktop\googlesamples-android-play-location-2ed2964\ActivityProject\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-cast-framework\10.0.1\res\drawable-xxhdpi-v4\quantum_ic_forward_30_grey600_36.png into C:\Users\marschall\Desktop\googlesamples-android-play-location-2ed2964\ActivityProject\app\build\intermediates\res\merged\debug\drawable-xxhdpi-v4\quantum_ic_forward_30_grey600_36.png

    I am very new to Android developement and really dont know what to do.

    I appreciate any comments.

    Thanks in advance

    EDIT: My mistake! Forgot to copy some files...

  • Melvin
    Melvin over 2 years
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
  • D.Y Won
    D.Y Won over 2 years
    Hi Melvin. Would you tell me why do you think my comment does not answer the question? I clearly stated in my comment that it might be helpful for those who uses non-English version of Windows OS.