android:android-jni
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
android:android-jni [2010/11/10 17:14] – percy | android:android-jni [2016/05/05 13:07] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Android JNI多线程相关 ====== | ||
+ | - http:// | ||
+ | - http:// | ||
+ | |||
+ | |||
====== Android JNI相关 ====== | ====== Android JNI相关 ====== | ||
收集一些Android JNI的使用方法。 | 收集一些Android JNI的使用方法。 | ||
+ | |||
+ | ====== JNA ====== | ||
+ | |||
+ | < | ||
+ | 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' | ||
+ | |||
+ | 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; | ||
+ | </ | ||
+ | |||
+ | - https:// | ||
+ | - https:// | ||
===== Android JNI介绍 ===== | ===== Android JNI介绍 ===== | ||
- Android JNI详述:参考http:// | - Android JNI详述:参考http:// | ||
Line 18: | Line 34: | ||
====== NDK Tips ====== | ====== NDK Tips ====== | ||
- | NDK的默认Android.mk路径指定在project/ | + | * NDK的默认Android.mk路径指定在project/ |
# | # | ||
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/ | APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/ | ||
+ | | ||
+ | * undefined reference to `wcstombs' | ||
+ | 默认的NDK,在用到wcstombs函数时(已经include < | ||
+ | 可以在这里下载打过patch的版本,http:// | ||
+ | |||
+ | |||
+ | | ||
Line 33: | Line 56: | ||
bash D: | bash D: | ||
</ | </ | ||
+ | ====== NDK编译脚本For windows ====== | ||
+ | 简单写了一个脚本,调用ndk-build编译SO文件, | ||
+ | 只支持两个参数 | ||
+ | nkdbuild build | ||
+ | ndkbuild clean | ||
+ | [[android: | ||
+ | ===== NDK编译脚本For Linux ====== | ||
+ | 1.支持编译静态库 | ||
+ | 2.解析Android.mk: | ||
+ | [[android: | ||
+ | |||
+ | |||
+ | ====== ndk-gdb调试 ====== | ||
+ | 利用ndk-gdb可以直接调试native code. | ||
+ | |||
+ | 命令: | ||
+ | bash / | ||
+ | |||
+ | 但在cygwin下调试时遇到了一个问题, | ||
+ | < | ||
+ | D: | ||
+ | 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" | ||
+ | There is absolutely no warranty for GDB. Type "show warranty" | ||
+ | This GDB was configured as " | ||
+ | / | ||
+ | </ | ||
+ | 找不到app_process文件, | ||
+ | 找到类似的问题: | ||
+ | |||
+ | 方法是修改ndk-gdb: | ||
+ | < | ||
+ | # Get the app_server binary from the device | ||
+ | APP_PROCESS=$APP_OUT/ | ||
+ | #run adb pull / | ||
+ | |||
+ | #Add by Jianqing Peng, | ||
+ | if [ -s " | ||
+ | run adb pull / | ||
+ | else | ||
+ | run adb pull / | ||
+ | fi | ||
+ | |||
+ | </ | ||
+ | ====== native crash log分析 ====== | ||
+ | [[android: | ||
/var/www/dokuwiki/wiki/data/attic/android/android-jni.1289380442.txt.gz · Last modified: 2016/05/05 13:06 (external edit)