User Tools

Site Tools


android:android-jni

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
android:android-jni [2010/11/15 16:10] percyandroid:android-jni [2016/05/05 13:07] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Android JNI多线程相关 ======
 +  - http://android.wooyd.org/JNIExample/files/JNIExample.pdf
 +  - http://groups.google.com/group/android-ndk/browse_thread/thread/da092bd665ca9ff1
 +
 +
 ====== Android JNI相关 ====== ====== Android JNI相关 ======
 收集一些Android JNI的使用方法。 收集一些Android JNI的使用方法。
 +
 +====== JNA ======
 +
 +<code>
 +JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.
 +
 +JNA allows you to call directly into native functions using natural Java method invocation. The Java call looks just like the call does in native code. Most calls require no special handling or configuration; no boilerplate or generated code is required.
 +</code>
 +
 +  - https://github.com/twall/jna
 +  - https://github.com/twall/jna/blob/master/www/AndroidDevelopmentEnvironment.md
 ===== Android JNI介绍 ===== ===== Android JNI介绍 =====
   - Android JNI详述:参考http://hi.baidu.com/zhang_sg1984/blog/item/d0d7fcdd698916d58d1029af.html,讲得比较详细   - Android JNI详述:参考http://hi.baidu.com/zhang_sg1984/blog/item/d0d7fcdd698916d58d1029af.html,讲得比较详细
Line 47: Line 63:
 [[android:android-jni:ndkbuild-bat-for-windows|Bat脚本for Windows]] [[android:android-jni:ndkbuild-bat-for-windows|Bat脚本for Windows]]
  
 +===== NDK编译脚本For Linux ======
 +1.支持编译静态库
  
 +2.解析Android.mk:支持指定编译后安装目录,支持编译前拷贝相关静态库到编译目录
  
 +[[android:android-jni:ndkbuild-shell-for-linux|NDK Shell For Linux]]
  
  
 +====== ndk-gdb调试 ======
 +利用ndk-gdb可以直接调试native code.
  
 +命令:
 +  bash /cygdrive/d/android/ndk/android-ndk-r4-windows/android-ndk-r4/ndk-gdb --start --force --verbose
 +
 +但在cygwin下调试时遇到了一个问题,
 +<code>
 +D:\workspace\DDTui>bash /cygdrive/d/android/ndk/android-ndk-r4-windows/android-ndk-r4/ndk-gdb
 +GNU gdb 6.6
 +Copyright (C) 2006 Free Software Foundation, Inc.
 +GDB is free software, covered by the GNU General Public License, and you are
 +welcome to change it and/or distribute copies of it under certain conditions.
 +Type "show copying" to see the conditions.
 +There is absolutely no warranty for GDB.  Type "show warranty" for details.
 +This GDB was configured as "--host=i686-pc-cygwin --target=arm-elf-linux".
 +/cygdrive/d/workspace/DDTui/bin/ndk/local/armeabi/app_process: No such file or directory.
 +</code>
 +找不到app_process文件,Google了一下,
 +找到类似的问题:http://code.google.com/p/android/issues/detail?id=8894
 +
 +方法是修改ndk-gdb:
 +<code>
 +# Get the app_server binary from the device
 +APP_PROCESS=$APP_OUT/app_process
 +#run adb pull /system/bin/app_process $APP_PROCESS
 +
 +#Add by Jianqing Peng,20101122
 +if [ -s "${COMSPEC}" ] ; then
 +    run adb pull /system/bin/app_process  "`cygpath -w $APP_PROCESS`"
 +else
 +    run adb pull /system/bin/app_process  $APP_PROCESS
 +fi
 +
 +</code>
  
 +====== native crash log分析 ======
 +[[android:android-jni:android-ndk-stacktrace-analyzer|native crash log分析]]
  
  
/var/www/dokuwiki/wiki/data/attic/android/android-jni.1289808650.txt.gz · Last modified: 2016/05/05 13:06 (external edit)