Visit Sponsor

Written by 9:15 am Mobile Development, NativeScript

TNS Build Android Hangs

Occasionally, while running a NativeScript application on android, the process hangs and does not complete. I have not gotten to the bottom of this, but I can tell you how I resolve the issue to continue running my application.

Symptoms – one of these


C:\_web\NativeScript\TradeOMatic>tns livesync android --emulator --watch
Project successfully prepared
The application with id "org.nativescript.TradeOMatic" is not installed on the device yet.
Project successfully prepared


C:\_web\NativeScript\TradeOMatic>tns build android
Project successfully prepared

In the above cases, the behavior is the terminal is stuck at the Project successfully prepared status and does nothing. I can watch which binaries are in control of the process, and on Windows, it gets stuck on find.exe.

If the tns livesync android –emulator –watch command hangs, I usually just run tns build android. Usually, this kicks off the build process. If it doesn’t, I’ll run tns build android again. This almost always works.

If, for some reason, no combination of the commands executed the build process. I remove the Android specific platform processes, then added them again. Example:


C:\_web\NativeScript\TradeOMatic>tns platform remove android
C:\_web\NativeScript\TradeOMatic>tns platform add android

When the build process runs, you will see a lot of console output. Example:


Project successfully prepared
execute: copyAarDependencies, addAarDependencies before configuration
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:deleteJavaDir UP-TO-DATE
:cleanLocalAarFiles UP-TO-DATE
:collectAllJars UP-TO-DATE
:ensureMetadataOutDir UP-TO-DATE

Then the changes made to the application are ready for deployment. You can use your favorite emulator command to push the build. I prefer tns livesync android –emulator –watch because changes are picked up and deployed automatically, significantly reducing the amount of time needed to validate each change on the emulator.

Visited 9,535 times, 1 visit(s) today
[mc4wp_form id="5878"]
Close