I've seen this error myself a couple times and it appears that several others have ran into it.. You type something like
tns run android or
tns build android and it gives you an error about some process failing to build -1 error and to try a
--stacktrace to see more info... Not entirely helpful. How do you do a
So let me tell you how to actually do a
--stacktrace; the magic is simple, but not obvious.
You need to do the following:
cd platforms/android ./gradlew buildapk --stacktrace
Pretty simple once you know it... This is what TNS uses to actually do the building part of the process; so when it fails; you need to manually run the process with the --stacktrace parameter. This will NORMALLY give you why it failed; however there are cases where it doesn't. So in those cases you try this command next:
./gradlew buildapk --stacktrace --info
And if that fails; then you try the really realllllllly reallllllllllly verbose output command:
./gradlew buildapk --stacktrace --debug > somefile.txt
Then open up the text file in some editor that can handle 5 megs of text and search for the first occurrence of "failed" will typically give you why it failed....
One interesting issue that I ran into the other day helping a buddy of mine... TNS seems to assume that anything not listed as a DevDependancy is a Dependancy; this can cause serious issues sometimes with things that actually should NOT be compiled into the app. TNS builds a module using
tar-pack. The authors of tar & tar-pack decided that the npm modules should have tests included in them (what???? Are you crazy?) and these tests have .tgz and .gz files in it. Unfortunately these .tgz and .gz files will cause the android tools to fail in a lot of cases when it attempts to process them.
So there is two ways to solve this issue:
- Add tar & tar-pack to your dev-dependancies.
- Manually enter your node_modules folder; and find tar/tar-pack and then delete the test folders.
In my opinion adding those two modules to your dev-dependancies simplifies things and then you don't forget about them at some later point if you have to reinstall your modules...
In addition if you need to determine the Gradle dependency tree you can use:
gradle app:dependencies --configuration debugRuntimeClasspath