{"id":359,"date":"2016-08-10T19:30:32","date_gmt":"2016-08-10T19:30:32","guid":{"rendered":"http:\/\/fluentreports.com\/blog\/?p=359"},"modified":"2021-01-28T01:59:37","modified_gmt":"2021-01-28T01:59:37","slug":"nativescript-debugging-the-android-build-process","status":"publish","type":"post","link":"http:\/\/fluentreports.com\/blog\/?p=359","title":{"rendered":"NativeScript: Debugging the Android Build Process"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I've seen this error myself a couple times and it appears that several others have ran into it..&nbsp;&nbsp; You type something like <code>tns run android<\/code> or <code>tns build android<\/code> and it gives you an error about some process failing to build -1 error and to try a <code>--stacktrace<\/code> to see more info...&nbsp; Not entirely helpful.&nbsp;&nbsp; How do you do a <code>--stacktrace?<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So let me tell you how to actually do a <code>--stacktrace<\/code>; the magic is simple, but not obvious.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need to do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd platforms\/android\n.\/gradlew buildapk --stacktrace<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pretty simple once you know it...&nbsp;&nbsp; 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.&nbsp; This will NORMALLY give you why it failed; however there are cases where it doesn't.&nbsp;&nbsp; So in those cases you try this command next:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/gradlew buildapk --stacktrace --info<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And if that fails; then you try the really realllllllly reallllllllllly verbose output command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/gradlew buildapk --stacktrace --debug > somefile.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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....<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One interesting issue that I ran into the other day helping a buddy of mine...&nbsp;&nbsp; TNS seems to assume that anything not listed as a DevDependancy is a Dependancy; this can cause serious <a href=\"https:\/\/github.com\/NativeScript\/nativescript-cli\/issues\/1989\">issues<\/a> sometimes with things that actually should NOT be compiled into the app.&nbsp;&nbsp; TNS builds a module using <code>gyp<\/code>; and <code>gyp<\/code> requires <code>tar<\/code> and <code>tar-pack<\/code>.&nbsp; The authors of tar &amp; tar-pack decided that the npm modules should have tests included in them (what????&nbsp; Are you crazy?) and these tests have .tgz and .gz files in it.&nbsp;&nbsp; Unfortunately these .tgz and .gz files will cause the android tools to fail in a lot of cases when it attempts to process them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So there is two ways to solve this issue:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Add tar &amp; tar-pack to your dev-dependancies.<\/li><li>Manually enter your node_modules folder; and find tar\/tar-pack and then delete the test folders.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">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...<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition if you need to determine the Gradle dependency tree you can use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gradle app:dependencies --configuration debugRuntimeClasspath<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I've seen this error myself a couple times and it appears that several others have ran into it..&nbsp;&nbsp; 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...&nbsp; Not entirely helpful.&nbsp;&nbsp;&hellip; <a class=\"more-link\" href=\"http:\/\/fluentreports.com\/blog\/?p=359\">Continue reading <span class=\"screen-reader-text\">NativeScript: Debugging the Android Build Process<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15,39],"tags":[17,56,16],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-nativescript","category-tips","tag-android","tag-debugging","tag-nativescript","entry"],"_links":{"self":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=359"}],"version-history":[{"count":5,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":1223,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions\/1223"}],"wp:attachment":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}