Android Studio - Space in user name causing crashes, NDK is not installed to this directory

无人久伴 提交于 2019-12-11 11:10:30

问题


I am trying to develop an android application with SDL and have been following this tutorial.

http://lazyfoo.net/tutorials/SDL/52_hello_mobile/android_windows/index.php

I followed this tutorial on my laptop earlier and actually completed the tutorial successfully until my laptop stopped working due to a battery issue.

I decided to just do the whole tutorial again on my main pc. This was going great until I reach part 15 in the tutorial. After following this tutorial's advice successfully I get a new error message upon building the project.

This error message is... interesting. You can read the bulk of it here.

Execution failed for task ':app:externalNativeBuildDebug'.

Build command failed. Error while executing process E:\androidsdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\androidprojects\game\app\src\main\jni\Android.mk NDK_APPLICATION_MK=E:\androidprojects\game\app\src\main\jni\Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=E:/androidprojects/game/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\androidprojects\game\app\build\intermediates\ndkBuild\debug\lib E:/androidprojects/game/app/build/intermediates/ndkBuild/debug/obj/local/x86/libmain.so} 'C:\Users\DAD' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. 'C:\Users\DAD' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. make: *** [E:/androidprojects/game/app/build/intermediates/ndkBuild/debug/obj/local/x86/objs-debug/main] Error 1

The most important part of the error message seems to be this: "C:\Users\DAD is not recognized as an internal or external command, operable program, or batch file. The system cannot find the path specified"

This repeats about three times. My username on this pc is "Dad & Mom" which has two spaces in it.

The android NDK does NOT work if it is installed to a path with spaces in it. I knew this and installed the SDK and NDK to the path "E:\androidsdk". I have checked and the program understands that the sdk is there.

So.. Why am I getting an error related to my username? My username on the laptop which I successfully completed the tutorial on earlier had no spaces in the username.

This is the issue I need help with. How can I remedy this? I'm willing to provide any extra information, just ask.


回答1:


I don't know what exactly went wrong here, but here is how you can try to figure out yourself. First, check if this is reproduced on normal command line (copy all the long command

E:\androidsdk\ndk-bundle\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\androidprojects\game\app\src\main\jni\Android.mk NDK_APPLICATION_MK=E:\androidprojects\game\app\src\main\jni\Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=E:/androidprojects/game/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\androidprojects\game\app\build\intermediates\ndkBuild\debug\lib E:/androidprojects/game/app/build/intermediates/ndkBuild/debug/obj/local/x86/libmain.so

and run it from

E:\androidprojects\game\app>

prompt.

Second, add -n to thus command, and you will see all commands that ndk-build wants to invoke, and then we'll discover where it wants to acces your home directory.



来源:https://stackoverflow.com/questions/48161572/android-studio-space-in-user-name-causing-crashes-ndk-is-not-installed-to-thi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!