Build Failed (android)

I don’t really know what happened since last time where i built my project successfully, but now i can’t make it to build my ionic project for android platform.
Build process determines here: processDebugResources.
Error message:

.../platforms/android/build/intermediates/res/debug/values-v23/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

.../platforms/android/build/intermediates/res/debug/values-v23/values.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

I don’t use any material design stuff in my project.

Cordova 5.4.1
Ionic CLI 1.7.10
Android SDK Tools 24.4.1 installed
Android SDK Platform-tools 23.0.1 installed
Android SDK Build-tools 23.0.2 installed
Android 6.0 (API 23) SDK Platform installed
Android M (API 22) SDK Platform Android M Preview installed
Android 5.1.1 (API 22) SDK Platform installed
Android 4.4W.2 (API 20) SDK Platform installed
Android 4.4.2 (API 19) SDK Platform installed

In .../platforms/android/AndroidManifest.xml you can find this line: <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />.

I tried to set android:targetSdkVersion in the manifest-XML to 23. No success.
I removed Android SDK Build-tools 23.0.2 and installed Android SDK Build-tools 22.0.1. No success.

Don’t know what to do.
Building for iOS platform works.

Thanks for help!

1 Like

exact same issue here

Ok, for me the problem was with the cordova.plugins.diagnostics. after removing it i was able to build with the Android SDK tools 22.0.1.
after tring installing older version of the plugin the build succeed:
cordova plugin add --save cordova.plugins.diagnostic@2.2.0
but it was sad to realize it wont work on any device runing marshmelow because of the new approach android is taking upon premissions, just like IOS, live premmision requests on usage.

so the solution, as suggested here unde Important android note, you must compile with the Android SDK build tools 23.x.

run android in your command line and install all the 22&&23 APIs including the build tools, and add this lines to your config.xml.

  <preference name="android-minSdkVersion" value="16"/>
  <preference name="android-targetSdkVersion" value="23"/>

this will dictate the sdk build number. in order for this to take effect a new AndroidManifest.xml file must be generated, to guarentee it just remover ad add the android platform to the projet, and use hooks:

ionic platform remove android
ionic hooks add
ionic platform add android

ionic android build should work now.


Thanks Muffasa.
You’re right. The diagnostics plugin is the “problem”.

But your approach doesn’t work for me. I added


to my config.xml.
But when i do this

ionic platform remove android ionic hooks add ionic platform add android

i get the following output:

Creating Cordova project for the Android platform: Path: platforms/android Package: <PACKAGENAME> Name: <NAME> Activity: MainActivity Android target: android-22

Build process fails again:

FAILURE: Build failed with an exception (processDebugResources): Failed to run command: /usr/local/Cellar/android-sdk/24.4/build-tools/23.0.2/aapt package -f --no-crunch -I /usr/local/Cellar/android-sdk/24.4/platforms/android-22/android.jar -M /.../platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /.../platforms/android/build/intermediates/res/debug -A /.../platforms/android/build/intermediates/assets/debug -m -J /.../platforms/android/build/generated/source/r/debug -F /.../platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package <PACKAGE-NAME> -0 apk --output-text-symbols /.../platforms/android/build/intermediates/symbols/debug Error Code: 1 Output: /.../platforms/android/build/intermediates/res/debug/values-v23/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. /.../platforms/android/build/intermediates/res/debug/values-v23/values.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

Any suggestions?
Thank you!

Has anyone managed to get a solution to this?

I have ran into the same problem and need to launch an app that relies on this plugin this week so need to either get this working or find another solution that allows me to tell if a user has their GPS turned off or not.

iwan_uschka I think im at the same stage as you, I have updated everything to use version 23 and have the target set to 23 and yet I get the same error message as you.

Have you had any luck figuring it out?

You need to use:
ionic platform add android@5.0.0

Since I’ve helped you, maybe you can help me:
When you now use ionic run, does it uninstall your application before installing it again?
Mine does, and it means i lose my localStorage and database between ionic runs. It never did this before.
See [WORKAROUND] “ionic run” started uninstalling before installing


ZephDavies, that did it! I wish I had known this yesterday as it would have saved me a lot of pain haha.

As for your issue, im not quite sure as I am now getting an error saying ANDROID_SDK_ROOT is undefined and This AVD’s configuration file is missing a kernel file. This could be due to me messing around with things earlier though so ill get to the bottom of that and let you know.

1 Like

Thanks ZephDavies. That did it for me.
Do we have to add the platform version because it’s not released officially? Couldn’t find any information about it on the cordova website.

I saw similar issues yesterday when trying to integrate instabug, which had updated its SDK to use 23 android support library. I can confirm editing build.gradle in android studio:

/* compileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion
compileSdkVersion 23
buildToolsVersion "23.0.1"

and then following Android Studios prompts to update build tools was a “quick fix” to get a good build.

Note: I always integrate instabug afterwards in Android Studio, but this could help people that are seeing the latest versions of plugins expecting 23 as the compile environment.

I’m hoping to find that I can set an environment variable that ionic/cordova will pick up so I don’t have to set compileSdkVersion and buildToolsVersion manually in build.gradle


Thanks for the tip.

Although this fixed the issue for me. I was running a version 4.4.4 genymotion emulator. I’d expect a build built against 5.0.0 to not work there but apparently it works. Why?

The other question is I wonder if this would lock me in a specific of Android OS. What if I wanted to test multiple android versions? I just tried ionic platform add android@4.4.4 didn’t seem to do anything.

Here is what I did :

Upgrade your library to API23

 <preference name="android-minSdkVersion" value="16"/>
 <preference name="android-targetSdkVersion" value="23"/>

Add this to config.xml.

Then go to /platforms/android/ and update the target to 23

Check cordova platform ls
The version must be 5 or greater, so if not: cordova platform rm android && cordova platform add android@5

1 Like

Thank you brother, you saved my life… i was stuck on this from many days.
i removed Cordova Diognostic and it work like charm
But, if i want to use Cordova Diognostic which version you prefer to install

hey thaker, please see documentation of cordova-diagnostic, you can read there what to do if you prefer to use deprecated version of the plugin because of using old android platform version

otherwise i would prefer of course to use latest version of the plugin (and using latest version of android platform) because a lot of useful features were added to the last releases

I would think unless you rename your package, or change ap ID in config.xml it will be overridden