Failed to build app with apache cordova on ubuntu 16.04

2

Greetings friends, I have a problem with apache cordova when building my application. I am using ubuntu 16.04 LTS 32 bits I have been able to investigate the matter and I have found that there are similar problems in this version of ubuntu , the version of cordova that I use is 6.3.0 The necessary tools to build this type of applications are the following and with their respective version:

  

version of nodejs 4.2.6
  version of apache ant 1.9.6
java-8-openjdk-i386
SDK manager rev 25.1.7
  Tools Android SDK tools version 25.1.7
Android SDK platform-tools version 24.0.1
Android SDK build-tools 24.0.1
  Android 6.0 (API 23)
  Extras Google repository and Android support repository

Environment variables of the "SDK" location: ~/.bashrc

export PATH=$PATH:/opt/android/sdk/platform-tools
export PATH=$PATH:/opt/android/sdk/tools

When executing the command

:~/cordovaApp$ cordova build android

As a result I receive the fault

ANDROID_HOME=/opt/android/sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386
Incremental java compilation is an incubating feature.
: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 UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android/sdk/build-tools/24.0.1/aapt'' finished with non-zero exit value 2

* 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: 11.157 secs
Error: /home/ricar1997/cordovaApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

Someone who has the same problem in ubuntu 16.04 would be very helpful if he could find the solution to this question.

    
asked by Ricardo Moreno 12.08.2016 в 18:39
source

2 answers

1

Your error message is:

  

aapt '' finished with non-zero exit value 2

Now that I read your question carefully I see that you use

  

ubuntu 16.04 LTS 32 bits   Y    Android SDK build-tools 24.0.1

In Android Studio I had the same problem with build-tools 24.0.1 I had to change the configuration in build.gradle to version 23.0.3, configure a version of Build-tools and platform-tools to a version before 24.0.1 for example 23.0.1 or 21.0.3 (I think it's the previous one).

and try again, comment results.

Update:

This problem as we can deduce is presented when changing to Android SDK build-tools 24.0+, it is generated because this version requires Java 8.0. If we do not have this version of Java this problem occurs, no doubt in the not too distant future we will need to update.

In fact, until today 12 August 2016 version 24.0+ is not registered on the page of SDK Build Tools releases , the last one is

  

Build Tools, Revision 23.0.3 (March 2016)

    
answered by 12.08.2016 / 20:21
source
0

Less than a month ago I placed a question that referred to exactly the same as this question, but nobody answered me, thank you very much Elenasys I had the same problem and I could solve thanks to your answer, in my case I also use cordova and not use much gradle, so I do not know how to configure it, look in the file build.gradle as you said and it is not very clear which is the version of the build-tools that actually uses gradle or at least I could not define what was the version in that file, but in that file if it says in comments that a build-tools version was used higher than the 19.x.x , even in the documentation of the cordova website it also says the same, so the solution that I got it was to de% del sdk-android versions 24.x.x and install the 23.0.3 which is the immediate lower version of build-tools and that was the solution to the problem, now when I compile with cordova build android everything goes great. So call Ricardo Moreno, try what I did to see if it works! Greetings!

    
answered by 12.08.2016 в 21:57