下载
http://developer.android.com/intl/zh-cn/tools/sdk/ndk/index.html
。。。。386M,解压开1.4G,太震撼了
之前下的好像没这么大。。。。
目录结构

然后集成进android SDK
就找到个 这个

。。。。
无意中搜到android 结构图

。。。。
对项目增加Native支持
右键项目,android tools ,add native support

目测自动增加了jni和obj

cpp不是C++的?我想要C啊。。。。
然后,改掉
报错
07-07 01:34:36.140: E/AndroidRuntime(1432): java.lang.UnsatisfiedLinkError: Native method not found: dc.test.hey.activity.TestNdkActivity.stringFromJNI:()Ljava/lang/String;
native method找不到,找不到就是路径不对。
找了一堆eclipse配置的方法。。。。
然后,各种报错
/home/senrsl/android/android-ndk-r9d/ndk-build.cmd: 1: /home/senrsl/android/android-ndk-r9d/ndk-build.cmd: @echo: not found
/home/senrsl/android/android-ndk-r9d/ndk-build.cmd: 2: /home/senrsl/android/android-ndk-r9d/ndk-build.cmd: rem: not found
/home/senrsl/android/android-ndk-r9d/ndk-build.cmd: 3: /home/senrsl/android/android-ndk-r9d/ndk-build.cmd: call: not found
/home/senrsl/android/android-ndk-r9d/ndk-build.cmd: 4: /home/senrsl/android/android-ndk-r9d/ndk-build.cmd: Syntax error: "(" unexpected (expecting "then")
然后 回到官网
http://developer.android.com/intl/zh-cn/tools/sdk/ndk/index.html#Samples
。。。。官网是cmd方式

试着去折腾hello-jni,结果,竟然出来了
- senrsl@senrsl-desktop:~/android/android-ndk-r9d/samples/hello-jni$ ~/android/android-ndk-r9d/ndk-build
- Android NDK: WARNING: APP_PLATFORM android-8 is larger than android:minSdkVersion 3 in ./AndroidManifest.xml
- [armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver
- [armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup
- [armeabi] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
- [armeabi] Gdbsetup : libs/armeabi/gdb.setup
- [x86] Gdbserver : [x86-4.6] libs/x86/gdbserver
- [x86] Gdbsetup : libs/x86/gdb.setup
- [mips] Gdbserver : [mipsel-linux-android-4.6] libs/mips/gdbserver
- [mips] Gdbsetup : libs/mips/gdb.setup
- [armeabi-v7a] Compile thumb : hello-jni <= hello-jni.c
- [armeabi-v7a] SharedLibrary : libhello-jni.so
- [armeabi-v7a] Install : libhello-jni.so => libs/armeabi-v7a/libhello-jni.so
- [armeabi] Compile thumb : hello-jni <= hello-jni.c
- [armeabi] SharedLibrary : libhello-jni.so
- [armeabi] Install : libhello-jni.so => libs/armeabi/libhello-jni.so
- [x86] Compile : hello-jni <= hello-jni.c
- [x86] SharedLibrary : libhello-jni.so
- [x86] Install : libhello-jni.so => libs/x86/libhello-jni.so
- [mips] Compile : hello-jni <= hello-jni.c
- [mips] SharedLibrary : libhello-jni.so
- [mips] Install : libhello-jni.so => libs/mips/libhello-jni.so

额
然后去折腾4号
纠结了半天路径之后,

出来了。。。。
之间,发现。
这个文件的作用就是配置生成的平台

然后,清理以下项目,发现生成的so没了,
Run以下,他又自动生成了。


--
senRsl
2014-07-07 10:53
GMT+8 @Beijing Tongzhou
senRsl
2014-07-07 10:53
GMT+8 @Beijing Tongzhou
没有评论 :
发表评论