Using pthread in Android
来源:互联网 发布:变性人有快感吗 知乎 编辑:程序博客网 时间:2024/05/29 04:39
【原创文章,转载请保留或注明出处:http://blog.sina.com.cn/s/blog_675eba3901010tnk.html】
I have a project about some system-layer in Android mainly using linux 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>
void threadmethod()
{
}
int main(void)
{
}
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 a lib .
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 I exec the command "chmod 777 hello-jni" it always fails .
Then I push into folder /data/data and exec the same command successfully .
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 with ndk-r7
- Using pthread in Android
- Using JSON in Android
- Using Google Maps in Android
- Using Google Maps in Android
- Using Android in Industrial Automation
- Using Google Maps in Android
- Using MultipartEntity in Android applications
- Using SQLite in Android Application
- pthread issue in program
- pthread in c++
- Using SQLite from Shell in Android
- Using color in Android, by XML
- Using Android monkeyrunner from Eclipse in Windows
- Location-Based Services Using CellID in Android
- Asynchronous HTTP Requests in Android Using Volley
- Asynchronous HTTP Requests in Android Using Volley
- Asynchronous HTTP Requests in Android Using Volley
- Using AlarmManager and BroadcastReceiver in Android
- php curl发送post请求的注意点
- 视频处理控件TVideoGrabber混合多个视频源(1)
- 电磁兼容测试实质
- 求城市A到B的路径数
- getopt函数
- Using pthread in Android
- android笔记--Intent和IntentFilter详解
- 通信协议中的数据类型的转换
- 作为一个程序员,我常去的网站
- phpdoc
- org.eclipse.ui.PartInitException: 编辑器初始化失败:位置不正确
- TypeError: dist must be a Distribution instance
- [小说]魔王冢(50)身份
- Scripts:执行双网卡绑定