Hello I am new to Android and I am trying to build the hello-jni sample that is included in the NDK but I get the error below, any idea how to fix it?
15:57:10 ** Build of configuration Default for project HelloJni **
/media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/ndk-build
all Android NDK: WARNING: APP_PLATFORM android-19 is larger than
android:minSdkVersion 3 in ./AndroidManifest.xml [armeabi-v7a]
Compile thumb : hello-jni <= hello-jni.c arm-linux-androideabi-gcc:
error trying to exec
'/media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/as':
execv: Exec format error make: *
[obj/local/armeabi-v7a/objs/hello-jni/hello-jni.o] Error 1
15:57:10 Build Finished (took 230ms)
This is what I am using:
Ubuntu 10.04.4
ADT bundle for linux (v22.3.0-887826)
NDK r9c
Thanks in advance
The WARNING is correct, and should be ignored.
Regarding the gcc error, you probably have a problem with installation of NDK. How did you unpack it? Check
ls -l /media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/as
This should be a symbolic link to ../../bin/arm-linux-androideabi-as, and both should have executable permissions.
Related
I am currently working on trying to compile the stressapptest (link: https://github.com/stressapptest/stressapptest) using the NDK environment, and for some reason, I'm having a hard time. These are the steps that I have taken:
Clone the repository onto my computer
Added a jni folder and moved all the files into it
Created an Application.mk file
Opened PowerShell from the location of my jni folder and execute ndk-build. This is the error I'm getting:
PS C:\Users\...\Desktop\stressapptest-master\stressapptest-master> ndk-build
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16.
[arm64-v8a] Compile++ : stressapptest <= main.cc
In file included from jni/src/main.cc:17:
jni/src/sattypes.h:25:10: fatal error: 'algorithm' file not found
#include <algorithm>
^~~~~~~~~~~
1 error generated.
make: *** [obj/local/arm64-v8a/objs/stressapptest/src/main.o] Error 1
Is there anything else that I need in order to compile this to run on an Android system?
Set APP_STL to c++_shared in your Application.mk. ndk-build does not use any STL by default.
After downloading the Android Source Code using the repo command as suggested on the page:
repo init -u https://android.googlesource.com/platform/manifest
I was able to compile the whole project without issue using make.
What I would like to do is compile my own fork of android.media.MediaPlayer, but I am lost as to how to set up the build.
I tried using ndk-build in /frameworks/base/media/libmedia, and got the following output:
Android NDK: WARNING:/home/user/android/WORKING_DIRECTORY/frameworks/base/media/jni/Android.mk:media_jni: non-system libraries in linker flags: -lpthread
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi] Compile++ thumb: audioeffect_jni <= android_media_AudioEffect.cpp
/home/user/android/WORKING_DIRECTORY/frameworks/base/media/jni/audioeffect/android_media_AudioEffect.cpp:22:23: fatal error: utils/Log.h: No such file or directory
compilation terminated.
make: *** [/home/user/android/WORKING_DIRECTORY/frameworks/base/media/obj/local/armeabi/objs/audioeffect_jni/android_media_AudioEffect.o] Error 1
How could I compile a .jar that contained libmedia and android.media.MediaPlayer so that I could simply drop it into a project and use that instead of the default android.media.MediaPlayer?
I'm new to Android programming and NDK, so i've followed this tutorial:
http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/ to
install and config cygwin and NDK. The problem appears when I try to execute
ndk-build command. It displays the following error message:
$ $NDK/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 3in ./AndroidManifest.xml
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
install: nie można wykonać stat na `/cygdrive/d/Programowanie/Tools/ADT/NDK/prebuilt/android-arm/gdbserver/gdbserver': No such file or directory
/cygdrive/d/Programowanie/Tools/ADT/NDK/build/core/setup-toolchain.mk:155: polecenia dla obiektu 'libs/armeabi/gdbserver' nie powiodły się
make: *** [libs/armeabi/gdbserver] Błąd 1
Error messages are written in polish so here's my translation, however I'm not sure whether
it's fully correct:
$ $NDK/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 3in ./AndroidManifest.xml
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
install: Cannot execute stat on `/cygdrive/d/Programowanie/Tools/ADT/NDK/prebuilt/android-arm/gdbserver/gdbserver': No such file or directory
/cygdrive/d/Programowanie/Tools/ADT/NDK/build/core/setup-toolchain.mk:155: commands for object 'libs/armeabi/gdbserver' didn't succeed.
make: *** [libs/armeabi/gdbserver] Error 1
I honestly have no idea what could have caused such an error, so I'm counting that
You can help me anyhow.
Thanks :-)
Modern versions of NDK do not need cygwin. Try to run you build from normal cmd prompt. To be on the safe side, remove cygwin\bin from PATH.
I have fixed my issue with NDK by downloading it again and reinstalling.
It seems like I haven't downloaded entire NDK package, and that it caused
the problem. Sorry for trouble, I should have checked whether reinstall
could help in this case on the beginning, but this idea must have slept
my mind.
Thanks for letting me know that I don't need cygwin for NDK anymore :-)
Best regards, Buyuk.
I'm trying to rebuild my Native android project, however all of a sudden, ndk-build decides it doesn't want to, and seems to be sulking on me.
Here's my output:
nathan#nathan-K52F:~/COMBAT/engine/android-build$ android update project -p . -t 1 -s
Updated project.properties
Updated local.properties
Updated file ./proguard-project.txt
nathan#nathan-K52F:~/COMBAT/engine/android-build$ cd jni && ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build/jni$ ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build/jni$ cd ../
nathan#nathan-K52F:~/COMBAT/engine/android-build$ ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build$ //should be erroring here - yet nothing?
It however at least tries to build another native project:
nathan#nathan-K52F:~/GamePlay/samples/browser/android/jni$ ndk-build
/home/nathan/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in /home/nathan/GamePlay/samples/browser/android/AndroidManifest.xml
Android NDK: ERROR:/home/nathan/GamePlay/samples/browser/android/jni/Android.mk:gameplay: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /home/nathan/GamePlay/samples/browser/android/jni/../../../../gameplay/android/obj/local/armeabi/libgameplay.a exists or that its path is correct
/home/nathan/android-ndk-r8e/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
nathan#nathan-K52F:~/GamePlay/samples/browser/android/jni$
The error's are suppose to be there by the way.
I just haven't a clue why it isn't compiling the project I WANT it to compile - I don't think it likes me anymore :L
I'm running on the latest Ubuntu OS, with NDK r8 and JDK 1.7
I didn't add my the new files to my makefile to be compiled.
I am getting some issues here while I am trying to compile my code with Cgywin.
$ /cygdrive/c/native_work/android-ndk-r8b/ndk-build
Android NDK: WARNING: Unsupported source file extensions in jni/Android.mk for module main
Android NDK: NotePaperDetector.hpp
Install : libmain.so => libs/armeabi-v7a/libmain.so
so how I can compile the .hpp file ?
Now as #mah you said I have removed it from my Android.mk but now its showing some different error -
$ /cygdrive/c/native_work/android-ndk-r8b/ndk-build
Compile++ thumb : main <= NotePaperDetector.cpp
In file included from jni/NotePaperDetector.hpp:4:0,
from jni/NotePaperDetector.cpp:1:
jni/NoteLocation.hpp:4:30: fatal error: opencv2/opencv.hpp: No such file or directory
compilation terminated.
/cygdrive/c/native_work/android-ndk-r8b/build/core/build-binary.mk:255: recipe for target `obj/local/armeabi-v7a/objs/main/NotePaperDetector.o' failed
make: *** [obj/local/armeabi-v7a/objs/main/NotePaperDetector.o] Error 1
With the latest NDK releases you don't need Cygwin at all.
By the way a GNU/Linux platform is always the best for Android developers.