Nativescript-cli: App with tests can't be built after deleting the modules and platform folders

Created on 12 Aug 2016  路  6Comments  路  Source: NativeScript/nativescript-cli

_From @victorhurdugaci on August 11, 2016 17:59_

Using TNS 2.2.0 do the following:

tns create foo4 --ng
cd foo4
tns test init
rm -rf node_modules
rm -rf platforms
npm init
tns platform add android
tns livesync android --watch

Expected: the app runs and builds
Actual: the app fails to build

processF0DebugManifest
: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 '/usr/local/opt/android-sdk/build-tools/23.0.3/aapt'' 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: 50.073 secs
Command /Users/victor/temp/foo4/platforms/android/gradlew failed with exit code 1

System details, if they matter:

  • OSX El Capitain
  • Genymotion

_Copied from original issue: NativeScript/NativeScript#2569_

bug unit testing

Most helpful comment

Also seeing this issue on Android with karma. Is there any fix or further insight to what causes the issue?

All 6 comments

Hey @victorhurdugaci,

You do not need to add manually android platform, tns livesync android --watch will do this automatically and will create node_modules as well. I'm not sure however about npm init part. Why do you need this?

I've tested tns livesync android --watch with deleted node_modules and platforms and everything worked normally.

Whoops, that's a typo in the text that I wrote. Instead of npm init should be npm install.

Have you tried with an app that was not installed on the device? I've noticed that if I do it with an app that's already installed, it works fine.

Did a bit more investigation.

I believe the failure is caused by the karma package. Below are repro steps to reproduce the failure and also to stop it from showing again - the reason why I believe the karma package is the culprit.

It's important to not have the application installed before on the device. If it was previously installed, you cannot reproduce this issue. So, please try with a new app.

tns create appX1 --ng
cd appX1
tns test init # Select jasmine here
rm -rf node_modules/
rm -rf platforms/
tns platform add android
npm install
tns livesync android --watch

Result: you should get the error I mentioned before

Now:

Remove "karma": "^1.2.0" from package.json
rm -rf node_modules/
npm install
tns livesync android --watch

Result: the app works.

Also seeing this issue on Android with karma. Is there any fix or further insight to what causes the issue?

are you using web pack? if yes, try to run the test with --bundle

Following the steps provided I was unable to get an application to crash.

All test dependencies are stored as devDependencies (with exception to the nativescript-unit-test-runner package), and they shouldn't leak into the actual android applications.

Closing this as resolved.

Was this page helpful?
0 / 5 - 0 ratings