Can not create APK

Hello there!

I have an error when trying to do and APK from command:

meteor build /directory/output/ --server myserver:port
Remarkable info in the error below:

ANDROID_HOME=/usr/local/androidStudio/androidSDK
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386

* What went wrong:
    Execution failed for task ':CordovaLib:processReleaseResources'.

And command and error goes:

user@portatil:~/Documents/meteor/llar$ meteor build ~/Documents/apks/ --server localhost:3000
=> It looks like a simple tweak to your system's configuration will make many tools (including this Meteor command) more efficient. To learn more, see
   https://github.com/meteor/meteor/wiki/File-Change-Watcher-Efficiency
ANDROID_HOME=/usr/local/androidStudio/androidSDK                                   
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386
   Building Cordova app for Android          -feature.                                              
   Building Cordova app for Android          -                       
:preBuild
:preReleaseBuild
:checkReleaseManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles        -
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
   Building Cordova app for Android          \                                      
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources          \
   Building Cordova app for Android          |                              
   Building Cordova app for Android          |                                      
   Building Cordova app for Android          |                               
   Building Cordova app for Android          |                                 
:CordovaLib:generateReleaseAssets
:CordovaLib:mergeReleaseAssets
   Building Cordova app for Android          |                                  
 FAILEDding Cordova app for Android          /                                   
   Building Cordova app for Android          /
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/androidStudio/androidSDK/build-tools/25.0.0/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: 15.781 secs
=> Errors executing Cordova commands:         
                                              
   While building Cordova app for platform Android:
   Error: /home/user/Documents/meteor/llar/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1 Error output:
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':CordovaLib:processReleaseResources'.
   > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/androidStudio/androidSDK/build-tools/25.0.0/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.
   at ChildProcess.whenDone (/home/user/Documents/meteor/llar/.meteor/local/cordova-build/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
   at emitTwo (events.js:87:13)
   at ChildProcess.emit (events.js:172:7)
   at maybeClose (internal/child_process.js:854:16)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
   => awaited here:
   at Function.Promise.await
   (/home/user/.meteor/packages/meteor-tool/.1.4.2_3.1yz7mbo++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:35:12)
   at CordovaProject.runCommands (/tools/cordova/project.js:715:22)
   at CordovaProject.buildForPlatform (/tools/cordova/project.js:245:10)
   at /tools/cli/commands.js:1031:30
   at /tools/utils/buildmessage.js:359:18
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at /tools/utils/buildmessage.js:352:34
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at /tools/utils/buildmessage.js:350:23
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at Object.enterJob (/tools/utils/buildmessage.js:324:26)
   at /tools/cli/commands.js:1007:22
   at /tools/utils/buildmessage.js:271:13
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at /tools/utils/buildmessage.js:264:29
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at /tools/utils/buildmessage.js:262:18
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at /tools/utils/buildmessage.js:253:23
   at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
   at Object.capture (/tools/utils/buildmessage.js:252:19)
   at Object.main.captureAndExit (/tools/cli/main.js:273:29)
   at /tools/cli/commands.js:993:10
   at buildCommand (/tools/cli/commands.js:990:37)
   at Command.func (/tools/cli/commands.js:827:12)
   at /tools/cli/main.js:1483:23

I tried with several Android SDK platforms versions, and also tried forcing to use them in file …/meteorApp/.meteor/local/cordova-build/platforms/android/build.gradle in line “buildToolsVersion cdvBuildToolsVersion” for line “buildToolsVersion ‘25’”, but an error very similar is shown.

I also tried removing every strange character from the code (á à ñ…) and uninstall and install the JDK and the Android Studio but nothing.

I found a couple of stackoverflow questions where seems to be a solution for a very similar error but nothing either. Also some questions in here the forums and the answers went through issues with special characters but I can not find any one more in my files.

I’m using xubuntu 16.04 32bits, Meteor 1.4.2.3 and Android Studio 2.2.2.0

Any ideas please?

Thanks!

UPDATE: I finally achieve to build the apk with only change the android sdk build-tools to rev 23.0.3, the
sdk platform 24 api - 2 rev and sdk platform 23 api - rev 3 in the Android Studio. But now when I try to install it in my Android 6.0.1 it shows the error “Parse Error: There was a problem while parsing the package.” The API I am using is for the Android 6 version, is there any known problem with the versions?

Thanks.

We have faced similar issue. What we do is we run meteor reset. Then build twice for android. The first fails, second succeeds. Beats me … but it does happen.

1 Like

Hi ramez! Thanks for answer.

I tried your solution but still have the same error.
I did remove the cordova-build folder in ./meteor/local/ and then ran “meteor reset” and twice "meteor build…"
I also clone the repo again from scratch and did all again with same error.

For ios, I have to build twice. First one will build, but will be non-functional in the device or in simulator. But the second build works. So ya, beats me too… But it works.

By the way, the two times build issue has been detailed in the meteor github repos in the issues https://github.com/meteor/meteor/issues/8338. But it has been solved by the latest Meteor 1.4.3.1 or even 1.4.2.6. I tested with the 1.4.3.1 version and you just do a single meteor build and it works. @ramez

1 Like

Thanks @kaiyes – will compile with new version and test. Appreciate your comment.

1 Like