随笔分类 - Android NDK
摘要:[参考资料] 为何binder在native不受支持 https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/1QmVRrNckfM 为何不支持内存共享、消息队列、信号量 ,参见https://android.googlesou
阅读全文
摘要:AudioFlinger(AF)是一个服务,具体的启动代码在av\media\mediaserver\Main_mediaserver.cpp中:int main(int argc, char** argv){ signal(SIGPIPE, SIG_IGN); char value[P...
阅读全文
摘要:Alsa Lib: File path:external/tinyalsaAudio Hal Library: Core File path:hardware/libhardware_legacy/audio/audio_hw_hal.cpp HAL library file:/system/...
阅读全文
摘要:Android Audio 系统的主要内容:AudioManager:这个主要是用来管理Audio系统的,需要考虑整个系统上声音的策略问题,例如来电话铃声,短信铃声等,主要是策略上的问题。AudioTrack:这个主要是用来播放声音的AudioRecord:这个主要是用来录音的当前分析AudioTr...
阅读全文
摘要:以Hello Android工程为例。建立好工程hello-a,在jni目录下创建文件hello-a.c,文件内容如下。(注意是jni目录,使用src目录编译会出错) #include int main(){ printf("Hello Android!\n"); return 0;}在...
阅读全文
摘要:前言一、android驱动的开发流程1: 写LINUX驱动2: 写LINUX应用测试程序3: 写JNI接口,用来包装第二步写的应用(要用NDK来编译)生成一个.SO文件,相当于CE下的DLL4: 写JAVA程序,专门写一个类包含.SO文件,然后在JAVA里调用.SO里的函数。例子,可以看NDK里面的...
阅读全文
摘要:This article's purpose is to generate a static/shared library which can be used in android ndk.Software Version: Cygwin 1.7.15-1 Android SDK 4.0.3 (API 15) Android NDK r81.Install Android-ndk and CygwinInstallNDK.Download the zip file and unzip itto thedestination folder.my isD:\Android\android-
阅读全文
摘要:A:Static library文件Android.mk:LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := hello-jniLOCAL_SRC_FILES := hello-jni.cinclude $(BUILD_S...
阅读全文
摘要:For the detail of JNI functions:http://www.public.iastate.edu/~java/docs/guide/nativemethod/functions.doc.html#173141.The Definition about JNIEnv is different in C and C++.#if defined(__cplusplus)typedef _JNIEnv JNIEnv; typedef _JavaVM JavaVM; #else typedef const struct JNINativeInterfac...
阅读全文
摘要:An Android.mk file is written to describe your sources to the build system. More specifically:- The file is really a tiny GNU Makefile fragment that will be parsed one or more times by the build system. As such, you should try to minimize the variables you declare there and do not assume that anythi
阅读全文
摘要:For detail:<ndk>/docs/android-mk.html一个Android.mk file用来向编译系统描述你的源代码。具体来说:该文件是GNU Makefile的一小部分,会被编译系统解析一次或多次。你可以在每一个Android.mk file中定义一个或多个模块,你也可以在几个模块中使用同一个源代码文件。编译系统为你处理许多细节问题。例如,你不需要在你的Android.mk中列出头文件和依赖文件。NDK编译系统将会为你自动处理这些问题。这也意味着,在升级NDK后,你应该得到新的toolchain/platform支持,而且不需要改变你的Android.mk文件
阅读全文
摘要:1.j***Array<->***[] (c++,not C)you can use jsize theArrayLength = env->GetArrayLength(arraySrc);to get the length of the array;jbyteArray->BYTE[] #define BYTE unsigned charjbyte * arrayTemp=env->GetByteArrayElements(arraySrc,0);//arraySrc is jbyteArray BYTE *arrayRet= (BYTE *)arrayTem
阅读全文
摘要:For the detail of JNI functions: http://www.public.iastate.edu/~java/docs/guide/nativemethod/functions.doc.html#17314Note:1.TheDefinition aboutJNIEnvis different in C and C++.#if defined(__cplusplus)typedef _JNIEnv JNIEnv;typedef _JavaVM JavaVM;#elsetypedef const struct JNINativeInterface* JNIEnv;t.
阅读全文
摘要:java:package com.nan.callback;import android.app.Activity;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.widget.Button;import android.widget.TextView;public class MyCallbackActivity extends Activity{ private Button intButton = ...
阅读全文
摘要:为了实现android的二次开发,希望通过编制动态链接库(.so)的方式实现android native C程序的调用。更为实际的情况则是:编制新库(new.so)调用android的老库(如libskia.so libskiagl.so)。以图形库skia为例,具体过程如下: 1.下载完整的skia代码,代码自己到google上搜吧(重要提示:wiki,TortoiseSVN)(更重要的提示:这步可以跳过,如果你的开发与硬件驱动无关的话) 2.通过git下载android源码:xxxx/core,xxxx/base,xxxx/skia三个文件夹就够了。(重要提示:xxxx我也忘了代表...
阅读全文
摘要:git是免费的开源的分布式的版本控制系统。我说的直白点,要强调的点是每个git clone下来的版本库都是一个完整的版本库,包括所有的历史记录和版本信息,不需要依赖网络,这点在使用的过程中你一定会有感触,git不是盖的。git很快,但是这点我没有大的感觉;git易于使用,相对svn而言,我不觉得git比之简单,但是总体来说git还是比较容易的,尤其是服务器端的部署非常简易。本文仅仅介绍一下git的简单使用。关于一些不常用的东西尽量会过滤掉。1.基本命令。?123456789101112131415161718/***这里列举几个常见的git命令,让大家过过目**/1)基本操作>git i
阅读全文
摘要:Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式版本控制软件,它不同于Subversion、CVS这样的集中式版本控制系统。在集中式版本控制系统中只有一个仓 库(repository),许多个工作目录(working copy),而像Git这样...
阅读全文
摘要:Reprinted fromhttp://www.ibm.com/developerworks/cn/opensource/tutorials/os-androidndk/section5.htmlFirst ,we will useandroid/bitmap.h,so thelowest ver...
阅读全文
摘要:Source:http://blog.csdn.net/hellogv/archive/2010/12/23/6094127.aspx在Android上使用JAVA实现彩图转换为灰度图,跟J2ME上的实现类似,不过遇到频繁地转换或者是大图转换时,就必须使用NDK来提高速度了。本文主要通过JAVA和NDK这两种方式来分别实现彩图转换为灰度图,并给出速度的对比。 从转换灰度图的耗时来说,NDK的确比JAVA所用的时间短不少。主程序testToGray.java的源码如下:package com.testToGray;import android.app.Activity;import a...
阅读全文