• 11
• 9
• 10
• 9
• 10

# Ndk-Build Stops All Next Commands In Batch File

This topic is 639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I've been building a batch file to build my android projects with ndk. My problem is, after I call ndk-build in the batch file to build my C/C++ code into a lib, all commands that come after in the batch file do not execute. Here is what it looks like:

ndk-build -B NDK_DEBUG=1 NDK_LIBS_OUT=%OutputDir%\lib NDK_OUT=%OutputDir%\obj
mkdir A


My batch file sets the paths for OutputDir and only has these 2 calls (for testing), yet the mkdir never executes because the folder A is never created. Once I remove the ndk-build command, mkdir executes. This also seems to happen when I call these 2 commands:

%AndroidCmdDir%\dx --dex --output="classes.dex" "fibpackage\FibLib.class" "fibpackage\FibActivity.class"
%AndroidCmdDir%\aapt package -v -f -M \AndroidManifest.xml -I %AndroidDir%/platforms/android-23/android.jar -F %OutputDir%/unsigned.apk %OutputDir%



If I have other commands after either of these 2 calls, they also don't get executed. I looked online but it doesn't seem like anyone is having this issue other than me. I'm using android ndk 12 which should be the latest one currently (downloaded from Android Studio's NDK manager) and I'm building for android-23.

##### Share on other sites
Try prefixing the line where it stops (i.e. the last one which actually executes) with "call" and see if that helps. Edited by Nypyren

##### Share on other sites

Try prefixing the line where it stops (i.e. the last one which actually executes) with "call" and see if that helps.

Ahh ofcourse it was that simple. Thanks a lot, this looks like it fixed my problem!

##### Share on other sites

Try prefixing the line where it stops (i.e. the last one which actually executes) with "call" and see if that helps.

This was also messing me up, I'd actually given up and just used multiple bat files but then I luckily saw the post. Gave it a go and it worked for me too. Thanks :D

Edited by Nanoha