James
James

Reputation: 39

Android ndk-build command does nothing

I have a similar question to that posted here:

Android NDK: why ndk-build doesn't generate .so file and a new libs folder in Eclipse?

...though I am running Windows 7, not Mac os. Essentially the ndk-build command is run, gives no error but doesn't create an .so file (also, since I'm on windows this should create a .dll and not an .so?). I tried running the command from the root, jni, src folders etc. but got the same result; cmd just returns to the prompter after a few seconds. I ran it again from the jni folder with NDK_LOG=1 parameter to see what was happening. Here is a portion of the transcript of the log results after running ndk-build in the jni folder (after it successfully identified the platform, etc.)...

Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity/jni
Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity
Android NDK: Found it !
Android NDK: Found project path: /workspace/NdkFooActivity
Android NDK: Ouput path: /workspace/NdkFooActivity/obj
Android NDK: Parsing /cygdrive/c/android-ndk-r8/build/core/default-application.mk
Android NDK: Found APP_PLATFORM=android-15 in /workspace/NdkFooActivity/project.properties
Android NDK: Application local targets unknown platform 'android-15'
Android NDK: Switching to android-14
Android NDK: Using build script /workspace/NdkFooActivity/jni/Android.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting release optimization mode (app is not debuggable)
Android NDK: Adding import directory: /cygdrive/c/android-ndk-r8/sources
Android NDK: Building application 'local' for ABI 'armeabi'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for 'armeabi' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /cygdrive/c/android-ndk-r8/sources/cxx-stl/system/Android.mk
Android NDK: Found in /cygdrive/c/android-ndk-r8/sources/cxx-stl/system
Android NDK: Cygwin dependency file conversion script:

...after which point it just runs the script mentioned in the last line, then terminates. Any ideas? Thanks!

Upvotes: 1

Views: 5259

Answers (3)

Vedran Klanac
Vedran Klanac

Reputation: 11

Following link was instructive but missing a detail if you are configuring NDK support in Eclipse after CDT it already depricated (summer of 2017 already).

http://maxters.net/2011/02/android-ndk-builder-for-eclipse-in-windows/

Where you need to configure your external builder Location, instead of pointing to cygwin\bin\bash.exe and adding as Argument your ndk-build.cmd location this is what worked for me on Windows 7 and 10.

In "Edit Configuration" dialog for external builder do following: - for Location -> specify where your "ndk-build.cmd" is. i.e "D:\Android\NDK\ndk-build.cmd" - for Arguments -> just specify "all"

Upvotes: 1

vitakot
vitakot

Reputation: 3844

Set up a builder. Refer to following article for how to do that:

http://maxters.net/2011/02/android-ndk-builder-for-eclipse-in-windows/

There is a "small" change beginning NDK r8 – Cygwin is not necessary anymore and I had a trouble when building native libraries with Cygwin and NDK r8 – there was some error message about cxx-stl...

Almost everything in the link above is OK, but leave Arguments in the Main tab blank and change Location to:

${env_var:ANDROID_NDK_ROOT}/ndk-build.cmd

I use system variable path ANDROID_NDK_ROOT, but you can provide a full path to the ndk-build.cmd. Also, there is no need to set any variable in the Environment tab.

Set up your builder this way and you will be fine.

Just a note, Android is built on the top of the Linux OS, so even if you are on Windows you will get Linux libraries with .so extension.

Upvotes: 2

Gene
Gene

Reputation: 46960

The NDK build system relies on wildcards to find the sources to compile. If you have a path wrong somewhere, it will find no sources and do nothing. Check Android.mk very carefully. More can't be said unless you post Android.mk and a description of the source tree.

Upvotes: 0

Related Questions