I have a project about some system-layer in Android mainly usinglinux C programming and NDK tools.For
The source code is too simple to pasted on ....
//src hello-jni.c ------------------------------------
#include <string.h>
#include <jni.h>
#include <pthread.h>
And the Android.mk 's content is listed as below:
LOCAL_MODULE
LOCAL_SRC_FILES := hello-jni.c
LOCAL_LDLIBS += -llog -lpthread
include $(BUILD_EXECUTABLE)
Notice the last line , I want to build a executable app not alib .
Don't forget add the pthread lib .
Then use ndk's command or script "ndk-build " to build an app,push it to your phone.
Firstly I push the file in my sdcard ,but in adb-shell when Iexec the command "chmod 777 hello-jni" it always fails .
Then I push into folder /data/data and exec the same commandsuccessfully .
I don't know why...
Then you can run your app on root authenticate.
With the Screenshot attached :
ps : my OS is ubuntu 10.10 withndk-r7
联系客服