我将ndk-build Makefiles添加到Android Studio 2.2项目中,以便能够在Android Studio中调试C ++代码。虽然我能够构建和调试代码,但是当我从构建类型切换构建类型时,我会在Gradle控制台窗口中收到奇怪的错误消息。发布到调试。错误消息是:
process_begin: CreateProcess(NULL, "", ...) failed.
process_begin: CreateProcess(NULL, "", ...) failed.
process_begin: CreateProcess(NULL, "", ...) failed.
process_begin: CreateProcess(NULL, "", ...) failed.
消息总数取决于构建变体的数量和活动的ndk ABI(#buildVariants * #ABIs)。如果只配置了一个ABI和两个构建变体(debug,release),则会打印错误消息2次。对于两个ABI和2个构建变体,它打印4次等。
为Gradle启用--debug
选项会显示消息在ndkBuild完成之前发生:
...
C:/data/Android/sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [armeabi-v7a] "Install ": "libmurl_openal_soft.so => C:\data\private\x\y\Test\project\android\gradle\app\build\intermediates\ndkBuild\debug\lib/armeabi-v7a/libmurl_openal_soft.so"
copy /b/y "C:\data\private\x\y\Test\project\android\gradle\app\.externalNativeBuild\ndkBuild\debug\obj\local\armeabi-v7a\libmurl_openal_soft.so" "C:\data\private\x\y\Test\project\android\gradle\app\build\intermediates\ndkBuild\debug\lib\armeabi-v7a\libmurl_openal_soft.so" > NUL
C:/data/Android/sdk/ndk-bundle/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded C:\data\private\x\y\Test\project\android\gradle\app\build\intermediates\ndkBuild\debug\lib/armeabi-v7a/libmurl_openal_soft.so
16:40:51.437 [ERROR] [org.gradle.api.Project] process_begin: CreateProcess(NULL, "", ...) failed.
16:40:51.437 [INFO] [org.gradle.api.Project] External native build debug: done executing ndkBuild
16:40:51.437 [INFO] [org.gradle.api.Project] External native build debug: write build output output C:\data\private\x\y\Test\project\android\gradle\app\.externalNativeBuild\ndkBuild\debug\armeabi-v7a\ndkBuild_build_output.txt
16:40:51.439 [INFO] [org.gradle.api.Project] External native build debug: parse and convert ndk-build output to build configuration JSON
...
我没有注意到构建结果本身有任何负面影响,如果构建APK,则不会显示任何错误消息。但是,构建变量开关期间的错误消息令人恼火。任何提示如何找到错误消息的根本原因将非常感激。