Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Build Error #161

Closed
vale95ntino opened this issue Dec 16, 2016 · 8 comments
Closed

Android Build Error #161

vale95ntino opened this issue Dec 16, 2016 · 8 comments

Comments

@vale95ntino
Copy link

vale95ntino commented Dec 16, 2016

Hey,

The plugin was working perfectly but after that I updated my android SDKs it's not working anymore.
I receive this error

What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\android-sdk\build-tools\25.0.2\aapt.exe'' finished with non-zero exit value 1

I tried removing and adding [email protected], removing all of my SDKs and downloading everything again.
I have installed
Android SDK Tool 25.2.4,
SDK platform 23,
Android Support Repository 41,
Google Play services 38,
Google Repository 41.

In my AndroidManifest.xml I specify
android:targetSdkVersion="23"

I have searched everywhere for two days and I just can't find a way to solve this.

If I remove the plugin I can build properly so the problem must be here.

Any ideas?

ordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.2.2
Xcode version: Not installed

@vale95ntino
Copy link
Author

Downgrading the plugin to @3.0.0 solves the issue

@dpa99c
Copy link
Owner

dpa99c commented Dec 20, 2016

I am able to reproduce this with [email protected] and [email protected]

console output
$ cordova platform rm android && cordova platform add [email protected]
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: cordova.plugins.diagnostic.example
        Name: Diagnostic_plugin_example
        Activity: MainActivity
        Android target: android-23
Android project created with [email protected]
Installing "cordova-custom-config" for android
Installing "cordova-plugin-camera" for android
Installing "cordova-plugin-compat" for android
Dependent plugin "cordova-plugin-compat" already installed on android.
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-geolocation" for android
Dependent plugin "cordova-plugin-compat" already installed on android.
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing "cordova.plugins.diagnostic" for android
cordova-custom-config: Skipping auto-restore of config file backup(s)
cordova-custom-config: Applied custom config from config.xml to D:\Git\cordova-diagnostic-plugin-example\platforms\android\AndroidManifest.xml

$ cordova build android
cordova-custom-config: Skipping auto-restore of config file backup(s)
cordova-custom-config: Applied custom config from config.xml to D:\Git\cordova-diagnostic-plugin-example\platforms\android\AndroidManifest.xml
ANDROID_HOME=G:\Users\dpa99_000\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Parallel execution with configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:generateDebugBuildConfig
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:mergeDebugShaders
:CordovaLib:compileDebugAidl
:CordovaLib:generateDebugBuildConfig
:compileDebugShaders
:generateDebugAssets
:generateDebugResValues
:CordovaLib:mergeDebugShaders
:incrementalDebugJavaCompilationSafeguard
:compileDebugNdk UP-TO-DATE
:prePackageMarkerForDebug
:processDebugJavaRes UP-TO-DATE
:validateDebugSigning
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:compileReleaseAidl
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:mergeReleaseShaders
:CordovaLib:compileReleaseShaders
:CordovaLib:generateReleaseAssets
:CordovaLib:mergeReleaseAssets
:CordovaLib:processReleaseManifest
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:incrementalReleaseJavaCompilationSafeguard
:CordovaLib:compileReleaseJavaWithJavac
:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareComAndroidSupportAnimatedVectorDrawable2510Library
:prepareComAndroidSupportAppcompatV72510Library
:prepareComAndroidSupportSupportCompat2510Library
:prepareComAndroidSupportSupportCoreUi2510Library
:prepareComAndroidSupportSupportCoreUtils2510Library
:prepareComAndroidSupportSupportFragment2510Library
:prepareComAndroidSupportSupportMediaCompat2510Library
:prepareComAndroidSupportSupportV42510Library
:prepareComAndroidSupportSupportVectorDrawable2510Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:mergeDebugAssets
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResourcesD:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

D:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'G:\Users\dpa99_000\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2 mins 28.135 secs
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

D:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'G:\Users\dpa99_000\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

If you look further up in the build log, you'll see an error like this:

:processDebugResourcesD:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
D:\Git\cordova-diagnostic-plugin-example\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

This arises from a mismatch between the Android compile SDK version and the support library / build tools version (see here).

It's easily resolved by updating the project to use the most recent cordova-android version:

cordova platform rm android && cordova platform add android@latest && cordova build android
console output
$ cordova platform rm android && cordova platform add android@latest

$ cordova platform add android@latest
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: cordova.plugins.diagnostic.example
        Name: Diagnostic_plugin_example
        Activity: MainActivity
        Android target: android-25
Subproject Path: CordovaLib
Android project created with [email protected]


$ cordova build android
cordova-custom-config: Skipping auto-restore of config file backup(s)
cordova-custom-config: Applied custom config from config.xml to D:\Git\cordova-diagnostic-plugin-example\platforms\android\AndroidManifest.xml
ANDROID_HOME=G:\Users\dpa99_000\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Parallel execution with configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:generateDebugBuildConfig
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk
:generateDebugResValues
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:incrementalDebugJavaCompilationSafeguard
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:compileDebugNdk UP-TO-DATE
:mergeDebugShaders
:compileDebugShaders
:CordovaLib:compileDebugShaders
:generateDebugAssets
:processDebugJavaRes
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:processDebugJavaRes UP-TO-DATE
:validateSigningDebug
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:compileDebugSources
:mergeDebugAssets
:transformClassesWithDexForDebug
:mergeDebugJniLibFolders
:transformNative_libsWithMergeJniLibsForDebug
:transformResourcesWithMergeJavaResForDebug
:packageDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 35.179 secs
Built the following apk(s):
        D:/Git/cordova-diagnostic-plugin-example/platforms/android/build/outputs/apk/android-debug.apk

@vale95ntino
Copy link
Author

Thank you so much!

@toricctan
Copy link

yes, thank you so much!

@rogerbernardi
Copy link

Yes!!!! Very, very, thank you!!!

@Doberjohn
Copy link

Thank you sir! Works like a charm!

@jvaranam
Copy link

Thanks,
"cordova platform rm android && cordova platform add android@latest && cordova build android" work for me

@tomavic
Copy link

tomavic commented May 2, 2017

I have done the same but I got the follwoing
`
C:\Users\IM\Desktop\mink-foodiee>cordova build android
ANDROID_HOME=C:\Users\IM\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:compileDebugAidl
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:compileReleaseAidl
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets
:CordovaLib:processReleaseManifest
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:compileReleaseJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library
:prepareComAndroidSupportAppcompatV72600Alpha1Library
:prepareComAndroidSupportSupportCompat2600Alpha1Library
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
:prepareComAndroidSupportSupportFragment2600Alpha1Library
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
:prepareComAndroidSupportSupportV132340Library
:prepareComAndroidSupportSupportV42600Alpha1Library
:prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library
:prepareComGoogleAndroidGmsPlayServicesBase1024Library
:prepareComGoogleAndroidGmsPlayServicesBasement1024Library
:prepareComGoogleAndroidGmsPlayServicesGcm980Library
:prepareComGoogleAndroidGmsPlayServicesIid980Library
:prepareComGoogleAndroidGmsPlayServicesLocation1024Library
:prepareComGoogleAndroidGmsPlayServicesTasks1024Library
:prepareMeLeolinShortcutBadger114Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues
:generateDebugResources
:mergeDebugResourcesAAPT err(Facade for 1399825024): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-ldpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 1850743791): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-xhdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 1850743791): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-xxhdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 1850743791): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-hdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 620299454): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-mdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 620299454): C:\Users\IM\Desktop\mink-foodiee\platforms\android\res\drawable-xxxhdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

:processDebugManifest
:processDebugResourcesC:\Users\IM\Desktop\mink-foodiee\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

FAILED

BUILD FAILED

Total time: 41.492 secs
C:\Users\IM\Desktop\mink-foodiee\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\IM\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Error: Error code 1 for command: cmd with args: /s,/c,"C:\Users\IM\Desktop\mink-foodiee\platforms\android\gradlew cdvBuildDebug -b C:\Users\IM\Desktop\mink-foodiee\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
    `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants