Android NDK with Linux: "ndk-build" command not found - android

I'm new to Linux (Ubuntu) and I had a problem building the libraries in my project.
I added the android ndk to the PATH like this:
export PATH=$PATH:/android-ndk-r9b
and to Eclipse
but when I try to use the
ndk-build
command, I get this output:
ndk-build: command not found
Any help?

Your PATH should include the root directory of your NDK:
export PATH=$PATH:/home/.../android-ndk-xxx

Related

Getting error while executing the ./build_native.sh from Cocos2d-x Android-Project

I'm getting error while executing the android-project created on Cocos2d-x, The error is:
$ ./build_native.sh
NDK_ROOT = D:\Updated Eclipse\android-ndk-r10
COCOS2DX_ROOT = /cygdrive/d/Cocos2d-x/cocos2d-x-2.2.5/projects/MyApp/proj.android/../../..
APP_ROOT = /cygdrive/d/Cocos2d-x/cocos2d-x-2.2.5/projects/MyApp/proj.android/..
APP_ANDROID_ROOT = /cygdrive/d/Cocos2d-x/cocos2d-x-2.2.5/projects/MyApp/proj.android
Using prebuilt externals
ERROR: You are using a non-Cygwin compatible Make program.
Currently using: D:/Cocos2d-X/Cygwin/bin/make
To solve the issue, follow these steps:
1. Ensure that the Cygwin 'make' package is installed.
NOTE: You will need GNU Make 3.81 or later!
2. Define the GNUMAKE environment variable to point to it, as in:
export GNUMAKE=/usr/bin/make
3. Call 'ndk-build' again.
I have installed all the required SW and set the path, environment etc properly,
Cocos2d-x version: Cocos2d-x-2.2.5
Android ADT: Latest Android SDK
Android NDK: android-ndk-r10
Cygwin: 32-bit
Cygwin package installed autoconf, automake, binutils, gcc-core, gcc-g**, gcc4-core, gcc4-g**, gdb, pcre, pcre-devel, gawk, make
Python: python-2.7.8.msi
The Path and environment are:
ANDROID_NDK_PATH C:\Users\d\Documents\Android\ndk\android-ndk-r8d
COCOS2DX_ROOT D:\Cocos2d-X\cocos2d-x-2.2.5
GNUMAKE /usr/bin/make
NDK_PROJECT_PATH D:\Cocos2d-X\cocos2d-x-2.2.5\projects
NDK_ROOT D:\Updated Eclipse\android-ndk-r10
Path D:\Cocos2d-X\Cygwin\bin
Please help me to fix this issue.
Thanks
Your NDK is in a folder "Updated Eclipse". You need to rename your folder such that it does not have any space. After renaming, update your NDK path in "build_native.sh" and then try rebuilding.

ndk-build command not found in Ubuntu terminal

I have successfully generated .h file using javah, now i want to build my android-ndk hello world project. But it says command not found
nespl#nespl-pc:~$ ndk-build
ndk-build: command not found
this is my path
nespl#nespl-pc:~$ echo $PATH
/home/nespl/android-ndk-r8/ndk-build:/home/nespl/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/nespl/adt-bundle-linux-x86/sdk/tools:/home/nespl/adt-bundle-linux-x86/sdk/platform-tools:/home/nespl/gsutil
Your PATH should include the root directory of your NDK:
export PATH=$PATH:/home/nespl/android-ndk-r8
instead of your current:
export PATH=$PATH:/home/nespl/android-ndk-r8/ndk-build

ndk-build platinum-jni failed: arm-linux-androideabi/bin/ld: error: cannot find -laxTls

To build the JNI shared library, you will need to have installed the Android NDK and set up the proper environment variables such as ANDROID_NDK_ROOT.
cd /Platinum
scons target=arm-android-linux build_config=Release
cd /Platinum/Source/Platform/Android/modules/platinum/jni
ndk-build NDK_DEBUG=0
import eclipse Android .project located # /Platinum/Source/Platform/Android/modules/platinum/
This will create the jar file # /Platinum/Source/Platform/Android/modules/platinum/bin/platinum.jar
The readme is above of building the platinum with ndk-build.
First step, command: "scons target=arm-android-linux build_config=Release", already succeeded.
Second step, command: "ndk-build NDK_DEBUG=0", failed. The failed log is below.
wingyip#ubuntu:~/Desktop/PlatinumKit-1-0-3-0_a71192_66de97/Platinum/Source/Platform/Android/module/platinum/jni$ ndk-buildStaticLibrary : libstdc++.aSharedLibrary : libplatinum-jni.so/home/wingyip/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -laxTls/home/wingyip/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/wingyip/Desktop/PlatinumKit-1-0-3-0_a71192_66de97/Platinum/Source/Platform/Android/module/platinum/jni/../../../../../../Build/Targets/arm-android-linux/Release/libNeptune.a(NptTls.o): in function NPT_TlsContext::~NPT_TlsContext():NptTls.cpp(.text._ZN14NPT_TlsContextD1Ev+0x18): error: undefined reference to 'ssl_ctx_free'
System: ubuntu
NDK version: android-ndk-r8c
I found this problem too. It's just a typo, open Android.mk then change
LOCAL_LDLIBS += -laxTls
to:
LOCAL_LDLIBS += -laxTLS
You can see the lib's name is libaxTLS.a.

How to build libav using ndk-build in cygwin for windowds?

I want to know how to build libav on windows7 using cygwin. I've tried the following steps :
1-change the directory using cd command to libav_file_directory/android(android folder is empty where the .so file will be saved as far as my knowledge is concern).
2-execute the ./ndk-buil command.
I got the following as result:
*Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/c/Users/balwant.singh.TA/Desktop/Android/android-ndk-r8/build/core/build-local.mk:130: * Android NDK: Aborting . Stop.*
plese reply with solution, and also I want to know which all android media player uses the libav as their native code.
1.)Set all your paths(Java_Home
2.)Set NDK_HOME to Ndk-Build Path
3.)Run Cygwin
4.)GO to project Library path
5.)Run make command
6.)then Run ndk-build

Compiling the Native Code with NDK

when I am Trying to compile native C code like this:
:~/com.***.sample.ndk1$ ./ndk-build
Android NDK: Could not find platform files (headers and libraries)
Android NDK: Please run build/tools/build-platforms.sh to build the corresponding directory.
/com.***.sample.ndk1/build/core/init.mk:345: *** Android NDK: Aborting . Stop.
:~/com.***.sample.ndk1$ build/tools/build-platforms.sh
.: 39: Can't open build/tools/../core/ndk-common.sh
:~/com.***.sample.ndk1$
The above error is shows.
Could anyone answer to solve this problem?
You have to add the Your NDK location directory to Your system PATH variable:
let suppose your ndk is in /opt/android/android-ndk-r8b folder, android sdk is in /opt/android/android-sdk folder
so, you may add the following lines to your ~/.bash_profile (at the end of file) :
export PATH=$PATH:/opt/android/android-ndk-r8b:/opt/android/android-sdk
in addition You can run the following commands:
chmod -R a+r /opt/android/android-ndk-r8b
chmod -R a+r /opt/android/android-sdk

Categories

Resources