5

I added working ndk-build Makefiles to a Android Studio 2.2 project to be able to debug C++ code within Android Studio. While I am able to build and debug the code, I get weird error messages in the Gradle Console window when I switch the build type from e.g. release to debug. The error message is:

process_begin: CreateProcess(NULL, "", ...) failed.

process_begin: CreateProcess(NULL, "", ...) failed.

process_begin: CreateProcess(NULL, "", ...) failed.

process_begin: CreateProcess(NULL, "", ...) failed.

The total number of messages depends on the number of build variants and active ndk ABIs (#buildVariants * #ABIs). If only one ABI and two build variants (debug, release) are configured, the error message is printed 2 times. For two ABIs and 2 build variants it is printed 4 times etc.

Enabling the --debug option for Gradle shows that the message happens before ndkBuild is done:

...
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
...

I did not notice any negative effect to the build result itself and no error messages are shown if the APK is build. Though, the error messages during build variant switches are irritating. Any hint how to find the root cause of the error messages would be very much appreciated.

Wolfgang
  • 86
  • 1
  • 6
  • I see the same error! It is only once that I saw the "intermediates/ndkBuild" created, could never see the .so file if I rebuilt it! I will post details! – RRR Sep 26 '16 at 18:49
  • And also, if I create the APK and then analyze it, it shows that there is a "lib" folder that contains the ".so", but I can't find it! – RRR Sep 26 '16 at 18:57
  • I also tried the "hello-jni" sample code, I don't see the "intermediates/ndkBuild" lib folders after building the project! Please help. – RRR Sep 26 '16 at 19:16
  • Also in the ndk_buildCommand_output.txt, NDK_PROJECT_PATH=null how can I fix this? – RRR Sep 26 '16 at 19:41
  • NDK_PROJECT_PATH is intentionally set to null. See https://code.google.com/p/android/issues/detail?id=220764#c2 – Wolfgang Sep 27 '16 at 09:31
  • Thanks Wolfgang. I am going to try the sample code Hello-JNI for one last time today on Ubuntu. I could never get it to working on Windows yesterday. – RRR Sep 27 '16 at 15:16
  • I don't see this error on Ubuntu however I don't see any intermediates/ndkBuild/lib folder created. – RRR Sep 27 '16 at 16:01
  • @RRR Obviously the intermediate files are stored in `project\app\.externalNativeBuild\ndkBuild\debug\obj\local`. The stripped `*.so` files are stored in `project\app\build\intermediates\transforms\stripDebugSymbol\release\folders\2000\1f\main\lib\armeabi-v7a` – Wolfgang Sep 28 '16 at 06:05
  • I have this problem too, this prevents Android Studio to correctly configure include path for gstreamer. Caused by -n parameter added by AS at sync time. – 胡玮文 Jun 22 '19 at 12:45

0 Answers0