{"id":6,"date":"2012-06-26T14:00:57","date_gmt":"2012-06-26T14:00:57","guid":{"rendered":"http:\/\/sysprogs.com\/?p=6"},"modified":"2012-07-23T12:40:26","modified_gmt":"2012-07-23T11:40:26","slug":"android-ndk-build-cmd-bug","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/w\/android-ndk-build-cmd-bug\/","title":{"rendered":"Android ndk-build.cmd bug"},"content":{"rendered":"<p>Just discovered a minor bug in the <strong>ndk-build.cmd<\/strong> script provided with <a href=\"http:\/\/developer.android.com\/tools\/sdk\/ndk\/index.html\">Android NDK<\/a> r8.<\/p>\n<p>If you&#8217;re calling <strong>ndk-build.cmd<\/strong> from Visual Studio, or any other IDE or script, beware that if your build fails, the script will still return an exit code of 0, as if no problem happened. This happens due to en error in the last line of the script:<\/p>\n<pre>%NDK_ROOT%\\prebuilt\\windows\\bin\\make.exe -f %NDK_ROOT%build\/core\/build-local.mk SHELL=cmd %* || exit \/b %ERRORLEVEL%<\/pre>\n<p>The <strong>%ERRORLEVEL%<\/strong> from running <strong>make.exe<\/strong> is not yet available when <strong>exit \/b<\/strong> is executed, so the script returns 0 despite the error returned by <strong>make<\/strong>.<\/p>\n<p>The fix is very simple: just remove the <strong> || exit \/b %ERRORLEVEL%<\/strong> from the last line. As the return value of the <strong>.cmd<\/strong> script is the return value of the last command, the error returned by <strong>make<\/strong> will be propagated by the script and your IDE will successfully detect it.<\/p>\n<p>You can get a fixed version of the script here: <a href=\"http:\/\/visualgdb.com\/KB\/ndk-build.zip\">http:\/\/visualgdb.com\/KB\/ndk-build.zip<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just discovered a minor bug in the ndk-build.cmd script provided with Android NDK r8. If you&#8217;re calling ndk-build.cmd from Visual Studio, or any other IDE or script, beware that if your build fails, the script will still return an exit code of 0, as if no problem happened. This happens due to en error in &hellip; <a href=\"https:\/\/sysprogs.com\/w\/android-ndk-build-cmd-bug\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Android ndk-build.cmd bug<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/posts\/6"}],"collection":[{"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":5,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":11,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/posts\/6\/revisions\/11"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/w\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}