文章分类 - NDK
1
摘要:public native void decode(Bitmap pTarget, byte[] pSource, int pFilter);
阅读全文
摘要:Native Android Project 建立顺序很重要,否则会出现意想不到的麻烦。 [Eclipse] 1、Launch Eclipse. In the main menu, go to File | New | Project.... 2、Then, in the opened New pr
阅读全文
摘要:1、armeabi This is the default option, which should be compatible with all ARM devices. Thumb is a special instruction set that encodes instructions on
阅读全文
摘要:Dalvik is a Virtual Machine on which the Dex bytecode is interpreted (NOT native code!). It is at the core of any application running on Android. Dalv
阅读全文
摘要:Step: 1、cd $ANDROID_NDK/samples/san-angeles 2、android update project -p ./ 3、ndk-build 4、ant debug 5、ant installd (debug mode) 6、adb shell am start -a
阅读全文
摘要:ndk-build 常用参数: NDK_PROJECT_PATH=. 指定NDK编译的代码路径为当前目录,如果不配置,则必须把工程代码放到Android工程的jni目录下 APP_BUILD_SCRIPT=./Android.mk 指定NDK编译使用的Android.mk文件NDK_APP_APPL
阅读全文
摘要:Android.mk 中变量含义: LOCAL_ variables: These are dedicated to individual module compilation and are defined in Android.mk files. APP_ variables: These re
阅读全文
摘要:Java Native Interface Specification—Contents http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/jniTOC.html JNI官方规范中文版 http://blog.csdn.net/a34
阅读全文
摘要:common.h 1 #pragma once 2 3 #include 4 5 /** 6 * Throws a new exception using the given exception class 7 * and exception message. 8 * 9 * @par...
阅读全文
摘要:AVILib 库来自 Transcode 的大型开源项目,Transcode-1.1.7下载地址:http://www.linuxfromscratch.org/blfs/view/svn/multimedia/transcode.html解压至 $ANDROID_NDK_HOME/sourcesc...
阅读全文
摘要:Socket 通信分为三种:1、面向连接的通信TCP;2、无连接的通信UDP;3、本地通信Local将 Android Emulator 上的 与主机上的 映射。任何输入到主机上端口号所指定端口的连接都会通过 adb 转发到 Android Emulator 的指定端口上。adb -s emula...
阅读全文
摘要:POSIX 线程也被简称为 Pthreads,是一个线程的 POSIX 标准。1 #include 2 3 int pthread_create(4 pthread_t* thread,5 pthread_attr_t const* attr,6 void* (*start_ro...
阅读全文
摘要:Facade 设计模式提供了封装 C/C++ 组件的机制,提供本地代码对外服务的统一的接口,这样就可以根据硬件的实际情况修改内部的本地 C/C++ 代码。一般而言,把云服务的 API 放在Android 的 libraries 中是一个非常好的选择,这样,Android 的应用程序就可以通过 NDK...
阅读全文
摘要:原生代码使用 Java 线程 1 /** 2 * Using Java based threads. 使用基于 Java 的线程 3 * 4 * @param threads thread count. 线程数 5 * @param iterations i...
阅读全文
摘要:Google 创建一个新的 C 库而不复用现有的 GNU C 库(glibc)或 Embedded Linux C 库(uClibc)的动机可总结为以下三点:1、许可:glibc 和uClibc 在 GNU Lesser General Public License(LGPL, GNU 宽通用公共许...
阅读全文
摘要:在 Android.mk 中添加 1 # 定义日志标签 2 MY_LOG_TAG := \"hello-jni" 3 4 # 定义基于构建类型的默认日志等级 5 ifeq ($(APP_OPTIIM),release) 6 MY_LOG_LEVEL := MY_LOG_LEVEL_ERROR ...
阅读全文
摘要:【注】1、在 Makefile 文件中,命令必须以【tab】键开始。否则会出现 “missingseparator.” 错误提示。2、编译正常,但出现 “Method 'NewStringUTF' could not be resolve” 错误,解决办法:http://stackoverflow....
阅读全文
摘要:1、字符串 1 // 用给定的 C 字符串创建 Java 字符串 2 jstring javaString; 3 javaString = (*env)->NewStringUTF(env, "Hello World!"); 4 5 // 将 Java 字符串转换成 C 字符串 6 const j...
阅读全文
摘要:1、基本数据类型Java 类型JNI 类型C/C++类型大小BooleanJbooleanunsigned char无符号8位ByteJbytechar有符号8位CharJcharunsigned short无符号16位ShortJshortshort有符号16位IntJintint有符号32位Lo...
阅读全文
摘要:原生方法带两个参数:JNIEXPORT jstring JNICALL Java_com_example_hellojni_HelloJni_stringFromJNI(JNIEnv *, jobject)1、JNIEnv是指向可用 JNI 函数表的接口指针。原生代码通过 JNIEnv 接口指针提供...
阅读全文
1

浙公网安备 33010602011771号