Various problems with Android NDK

Sysprogs forums Forums VisualGDB Various problems with Android NDK

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6651
    neta777
    Participant

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

    #6668
    support
    Keymaster

    Hi,

    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.

    #6694
    neta777
    Participant

    The 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?

    #6695
    support
    Keymaster

    This 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
    #6696
    neta777
    Participant

    There 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

    #6698
    support
    Keymaster

    Hi,

    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:

    1. Generate a Makefile that won’t build on Windows due to problems with parsing Windows-style paths
    2. 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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.