Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aapt error 138 processDebugResources

Ran in to this frustrating error today when building/making project, this seems to be since installing Android SDK 22.6 (have tried the 22.6.1 too) using build tools 19.0.1,19.0.2 and 19.0.3. The aapt error is causing R.java not to be generated.

I thought it was something project related as I have another project that builds ok. I've tried cleaning project/workspace, new workspace, reinstall Eclipse and Android SDK, then ported to Android studio gradle which is the error I've included below.

Edit: I also reverted project to previous commit that worked

Anyone ran in to this kind of thing? normally a clean works but not this time.

Error:Execution failed for task ':MyApp:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/scottab/dev/adt-bundle-mac-x86_64/sdk/build-tools/19.0.3/aapt package -f --no-crunch -I /Users/scottab/dev/adt-bundle-mac-x86_64/sdk/platforms/android-19/android.jar -M /Users/MyApp/build/manifests/debug/AndroidManifest.xml -S /Users/MyApp/build/res/all/debug -A /Users/MyApp/build/assets/debug -m -J /Users/MyApp/build/source/r/debug -F /Users/MyApp/build/libs/MyApp-debug.ap_ --debug-mode --custom-package com.myapp.android --output-text-symbols /Users/MyApp/build/symbols/debug
  Error Code:
    138
like image 217
scottyab Avatar asked Mar 18 '14 16:03

scottyab


2 Answers

I'm a little late, but if you originally included appcompat in your project and later removed it, there's probably a stale reference in your menu xml.

Here's what menu looks like with appcompat

<item android:id="@+id/action_settings"
    android:title="@string/action_settings"
    android:orderInCategory="100"
    app:showAsAction="never" />

See the app:showAsAction="never"? That's what the issue was for me. Switching it back to android:showAsAction="never" fixed it for me.

like image 53
Zac Sweers Avatar answered Oct 31 '22 22:10

Zac Sweers


This is a bug in AAPT, where it crashes when it sees a reference to a nonexistent resource. Unfortunately, it requires you to go through your resource files to try to spot the error, as it tends to not give you useful information.

This is written up in https://code.google.com/p/android/issues/detail?id=61308 and if you look there you'll find examples of what other users have fixed to solve the crash.

like image 32
Scott Barta Avatar answered Oct 31 '22 20:10

Scott Barta