Skip to content Skip to sidebar Skip to footer

Android Studio Build Failed At "processdebugresources" When Using 9-patch Images

I am following 'The Big Nerd Ranch's Android Programming Guide' book (2nd edition) and in a particular chapter (chapter 21), they ask you to use a 9-patch image for some image asse

Solution 1:

First off a little sanity boost for you

AAPT is exactly related to bundling the resources into your APK. Some great detail here including (IMO) the best diagram showing the different build steps. So your aapt problem aapt.exe'' finished with non-zero exit value 1 is almost certainly caused by your changing the 9-patches. No need to go back to square one, trying to remember what else you may have changed and eventually pulling all your hair out.

Verification

I was unable to duplicate your problem by directly running either of the root Gradle tasks (:app:generateDebugSources and :app:generateDebugAndroidTestSources). Nor was I able to duplicate the problem by running just the failing Gradle task: :app:processDebugResources.

Not caused by Configuration on Demand

It's unlikely that the problem is caused by a failure in the "configuration on demand". The line "Configuration on demand is an incubating feature." will also be printed if your build was successful.

Thoughts

It looks like you are using the latest Build Tools (23.0.2 as of this writing) versions, which is good.

You don't list it, but I'm guessing that you are also using the latest version of the Android-Gradle plugin (since they both came out at the same time and Android Studio defaults to using the latest). more info

What I would suggest is to go back and start with the first Drawable we ask you to implement: the ShapeDrawable and confirm that this works, then move on to the next one. This will help pinpoint where the problem is.

If you could provide link to your sample that would help too.

In the future with Gradle-related problems you can always run the Gradle task yourself (as I did above) and add the --info flag. From command line or "terminal" within Android Studio just run (in your case):

./gradlew app:generateDebugSources --info

Lastly, whatever you discover please post back here. The problem you are seeing isn't directly related to our book and your answer will help others.

Solution 2:

I had the same problem and I resolved it with:

./gradlew clean 

Post a Comment for "Android Studio Build Failed At "processdebugresources" When Using 9-patch Images"