Nativescript: tns build android problems

Created on 19 Sep 2016  ยท  10Comments  ยท  Source: NativeScript/NativeScript

When I run tns-build-android from the cli on a blank app the process fails at :processF0DebugResources. I even used the Hello world templates, process fails too.

But if I clone the sample-Groceries project, it builds successfully. Checked online and found solutions like:

tns platform remove android
tns platform add android
Moving the node_modules folder
Checking and deleting (if any) all zip, .tar, .gz
Restarted my system

Nothing works, but if I clone the sample-Groceries and build, it works successfully:

PS: Buildtools version was explicitly configured to version 22.0.1 because I use an old mac which can only support @ highest Mac 10.7.5 (Lion). Also, the platform-tools is not the latest, but a version that works for Mac 10.7.5. Apart from that, everything works flawlessly with the sample-Groceries.

This is the output from the terminal.

Project successfully prepared (android)

:config phase: createDefaultIncludeFiles
+found plugins: tns-core-modules-widgets

:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/configurations folder...

:config phase: pluginExtend
+applying configuration from: /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/configurations/include.gradle
+applying configuration from: /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase: copyAarDependencies

:config phase: addAarDependencies
+adding dependency: /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/libs/aar/widgets-release.aar
Observed package id 'platform-tools' in inconsistent location '/users/paschal/dev/android-sdk-macosx/platform-tools-old' (Expected '/users/paschal/dev/android-sdk-macosx/platform-tools')
Already observed package id 'platform-tools' in '/users/paschal/dev/android-sdk-macosx/platform-tools'. Skipping duplicate at '/users/paschal/dev/android-sdk-macosx/platform-tools-old'
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preF0DebugBuild UP-TO-DATE
:checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareBackupunlimitedRuntimeUnspecifiedLibrary UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:prepareWidgetsReleaseLibrary UP-TO-DATE
:prepareF0DebugDependencies
:compileF0DebugAidl UP-TO-DATE
:compileF0DebugRenderscript UP-TO-DATE
:generateF0DebugBuildConfig UP-TO-DATE
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE
:mergeF0DebugShaders UP-TO-DATE
:compileF0DebugShaders UP-TO-DATE
:generateF0DebugAssets UP-TO-DATE
:mergeF0DebugAssets UP-TO-DATE
:generateF0DebugResValues UP-TO-DATE
:generateF0DebugResources UP-TO-DATE
:mergeF0DebugResources UP-TO-DATE
:processF0DebugManifest UP-TO-DATE
:processF0DebugResources FAILED

FAILURE: Build failed with an exception.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/users/paschal/dev/android-sdk-macosx/build-tools/22.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: 28.435 secs
Command /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/gradlew failed with exit code 1

build android

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Usage โ”‚ Synopsis โ”‚
โ”‚ General โ”‚ $ tns build android [--compileSdk ] [--key-store-path --key-store-password - โ”‚
โ”‚ โ”‚ -key-store-alias --key-store-alias-password ] [--release] [--static-bindings] [--copy-to โ”‚ โ”‚ Path>] โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

Options

* --compileSdk - Sets the Android SDK that will be used to build the project.
* --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
* --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.

Attributes

is a valid Android API level. For example: 22, 23.

android

Most helpful comment

I just had this same issue and was able to resolve it by doing the following:

  1. Clean-up what's most-likely a mess at this point...

    1. tns platform remove ios

    2. tns platform remove android

    3. rm -fr ./node_modules

  2. Fix it... Maybe...

    1. tns install <- That one is important!!!

    2. tns platform add ios

    3. tns platform add android

Seems that if you've used npm >3.x then the module flattening is messing up Nativescript in some way... By using tns install you're forcing the nativescript-cli to use the version of npm specified in it's dependency list... 2.x.something.

Saw this in a different feed/repo, I think, but it's gotten me closer to a clean build execution. Now I'm just dealing with a bootstrap failure on simulator... :-/

All 10 comments

@paschaldev Could you navigate to /Users/Paschal/Desktop/ns/backup-unlimited/platforms/android/, execute ./gradlew --stacktrace and then post the output from the process? Also, what version is the nativescript (CLI) package? What about the tns-android package?

The nativescript and tns-android is the latest. I just installed it 3days ago. I will send the stack trace output as soon as I get on system

He @paschaldevwe - we haven't 'heard from you for a while - have you managed to resolve your issue!?

I just had this same issue and was able to resolve it by doing the following:

  1. Clean-up what's most-likely a mess at this point...

    1. tns platform remove ios

    2. tns platform remove android

    3. rm -fr ./node_modules

  2. Fix it... Maybe...

    1. tns install <- That one is important!!!

    2. tns platform add ios

    3. tns platform add android

Seems that if you've used npm >3.x then the module flattening is messing up Nativescript in some way... By using tns install you're forcing the nativescript-cli to use the version of npm specified in it's dependency list... 2.x.something.

Saw this in a different feed/repo, I think, but it's gotten me closer to a clean build execution. Now I'm just dealing with a bootstrap failure on simulator... :-/

Hey @JELaVallee thanks for tyhe reported solution to this issue.
I will close this one as resolved - if you need instruction on your bootstrap failure do not hesitate to contact us at the Nativescript/nativescript-angular or at SO

Am Passing thru hell trying to make nativeScript run on android. but I still get ERRORS

Starting DaemonProcessing node_modules failed. Error: Command gradlew.bat failed with exit code 1

and my directory structure has no space in it.

I just updated to NativeScript 3.0 and am getting the same error.

Starting DaemonProcessing node_modules failed. Error: Command gradlew.bat failed with exit code 1
capture

Irums It appears you have a 32 bit JDK installed on your machine, if that is the case install a 64 bit version and the error should not re occur

i got same error while i run tns run android or tns build android
output:
Command npm.cmd install [email protected] --silent --save-exact --save failed with exit code 1

i do research on my own, i check directory platform and it was empty.
i following step from @JELaVallee but i got the same error when i type command tns platform remove android

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guillaume-roy picture guillaume-roy  ยท  3Comments

Leo-lay picture Leo-lay  ยท  3Comments

hshristov picture hshristov  ยท  3Comments

rLoka picture rLoka  ยท  3Comments

yclau picture yclau  ยท  3Comments