Sysprogs forums › Forums › VisualGDB › Various problems with Android NDK
- This topic has 5 replies, 2 voices, and was last updated 9 years, 4 months ago by support.
-
AuthorPosts
-
June 28, 2015 at 08:53 #6651neta777Participant
Hi,
I’m trying to use VisualGDB to debug an Android app with NDK. I’m following this tutorial, but I’m using my own existing project.
I’m getting several errors when building with MS VS 2013 (pasted below):
1. The first error (file with spaces in the name – “ovx_jni – Copy.cpp”): I deleted this file, closed VS, did a rebuild, yet I still get an error on this.
2. The second error (“Please define the NDK_PROJECT_PATH variable to point to it.”): when I compile my native code from command line (ndk-build) it builds fine. I don’t know where I’m expected to define NDK_PROJECT_PATH,
Any help is much appreciated.
Thanks!
Neta
1> Arguments: NDK_DEBUG=1 APP_PLATFORM=android-3 VGDB_VSCONFIG=Debug clean
1> Directory: C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app
1>VisualGDB : error : Command-line action failed
1>VisualGDB : warning : Found a source file with spaces in the path: “C:\Users\nzmora\AndroidStudioProjects\AndroidVisualGdb\AndroidVisualGdb\..\..\CameraProcessor\app\src\main\jni\ovx_jni – Copy.cpp”. If the build fails, please rename/move it.
1>EXEC : warning : Could not find the auto-update marker in C:\Users\nzmora\AndroidStudioProjects\AndroidVisualGdb\AndroidVisualGdb\..\..\CameraProcessor\app\src\main\jni\Android.mk. Source list will not be updated.
1> VisualGDB: Run “C:\Users\nzmora\AppData\Local\Android\android-ndk-r10d\ndk-build.cmd NDK_DEBUG=1 APP_PLATFORM=android-3 VGDB_VSCONFIG=Debug” in directory “C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app” on local computer
1> Android NDK: Could not find application project directory !
1>C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app\\Users\nzmora\AppData\Local\Android\android-ndk-r10d\build\core\build-local.mk(148): error : Android NDK: Aborting . Stop.
1> Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
1> ————————————————————-
1> Command exited with code 2
1> Executable: C:\Users\nzmora\AppData\Local\Android\android-ndk-r10d\ndk-build.cmd
1> Arguments: NDK_DEBUG=1 APP_PLATFORM=android-3 VGDB_VSCONFIG=Debug
1> Directory: C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app
1>VisualGDB : error : Command-line action failed
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(43,5): error MSB3073: The command “”C:\Program Files (x86)\Sysprogs\VisualGDB\\VisualGDB.exe” /rebuild “C:\Users\nzmora\AndroidStudioProjects\AndroidVisualGdb\AndroidVisualGdb\AndroidVisualGdb.vcxproj” “/solution:C:\Users\nzmora\AndroidStudioProjects\AndroidVisualGdb\AndroidVisualGdb.sln” “/config:Debug” “/platform:Win32″” exited with code 1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========July 3, 2015 at 05:27 #6668supportKeymasterHi,
Please ensure that the jni folder is located directly inside the “C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app” folder.
If this does not help, please share a tree of all files (cmd /c tree /f > tree.txt) in the project directory.
July 11, 2015 at 10:35 #6694neta777ParticipantThe path to my JNI directory is C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app\src\main\jni.
So it is under “C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app”, but not _directly_ under.
I would like to preserve the directory structure which I’m using now. Is this possible?
July 11, 2015 at 22:02 #6695supportKeymasterThis would cause several bugs with the NDK tools. If you don’t want to move the actual files, you can create a symbolic link using the mklink command, i.e.
mklink /d C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app\jni C:\Users\nzmora\AndroidStudioProjects\CameraProcessor\app\src\main\jni
July 11, 2015 at 23:19 #6696neta777ParticipantThere are no problems using this path when I use the standard NDK tools. In fact, I think this is the standard way to do it. See https://developer.android.com/tools/projects/index.html:
main/jni/
Contains native code using the Java Native Interface (JNI). For more information, see the Android NDK documentation.
You can also check Google’s own NDK sample, which places the code here:
https://github.com/googlesamples/android-ndk/tree/master/hello-jni/app/src/main/jni
This is exactly how I built my directory structure.
BR
Neta
July 13, 2015 at 00:54 #6698supportKeymasterHi,
This is the directory where the Android Studio/gradle expect the native files. The problem is that the native support there is currently broken, so when Gradle tries to build the native files, it could:
- Generate a Makefile that won’t build on Windows due to problems with parsing Windows-style paths
- Strip the symbol information from the built libraries, making the debugging impossible
The exact gradle bugs change from version to version, so our current recommendation is to keep the source files in the app\jni directory and let VisualGDB handle the build. This will ensure that you won’t get strange build errors and that your symbols will be generated correctly. As soon as the Gradle support for native symbols becomes stable, we will update our tutorials to use the recommended paths.
-
AuthorPosts
- You must be logged in to reply to this topic.