自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 NDK r5 Toolchain 简单测试

<br />NDK r5 带的 toolchain 终于可以支持 makefile 的编译系统了。不过为了让它支持 GNU libc++ 还颇费了一番功夫,文档实在太缺乏了。下面是一个简单的试成功了的 case:<br /> <br />首先我们写一个简单的 C++ 程序,这里命名为 test.cpp,里面用到了 iostream, vector, typeid,libc++ 的基本特性都包含在里面了:<br />#include <vector>#include <iostream>#includ

2010-12-28 17:11:00 3347 3

原创 NDK r5 支持 RTTI 了

<br />在 NDK r5 的 sources/cxx-stl/gnu-libstdc++/README 文件里,写着:<br />To use it, define APP_STL to 'gnustl_static' in your Application.mk.See docs/CPLUSPLUS-SUPPORT.html for more details.This implementation fully supports C++ exceptions and RTTI.<br />也

2010-12-28 16:57:00 6391 2

原创 Android App 如何动态加载类

<br />在 Java 里面,我们可以把一些类放到 .jar 文件里面,然后用 ClassLoader 动态加载。例如:<br />URLClassLoader ucl = URLClassLoader.newInstance(new URL[]{new URL("file:/sdcard/files/test.jar")});Class clazz = ucl.loadClass("com.test.TestClass"); <br />但是在 Android 上面,情况有所不同。<br /> 

2010-12-24 19:38:00 28644 16

原创 开发 Standalone Android Java 应用程序

<br />一般来说,我们开发的 Android 应用程序都是基于 Activity 的,由 Android 系统来管理程序的生命周期;但是,有的时候,我们也想自己来控制程序的流程。例如,如果只是开发一个类似 /system/bin/pm 那样的 console 应用程序,用 Activity 就不合适了。这里我称这种自行控制流程的程序为 Standalone 的 Android 程序。<br /> <br />开发的方法和开发普通的 Java 应用程序并没有太大区别。例如,我们以 Java 的 Hello

2010-12-23 18:37:00 6191 2

原创 Android Native 应用程序启动 Activity 的方法

<br />调用 /system/bin/am.<br /> <br />用法:<br />usage: am [subcommand] [options]<br /><br />    start an Activity: am start [-D] [-W] <INTENT><br />        -D: enable debugging<br />        -W: wait for launch to complete<br /><br />    start a Servi

2010-12-17 10:21:00 3135

原创 Android HotPatch

如果要 patch 掉系统的一些服务,例如 installd, ps 之类,可以直接把 /system/bin/ 目录下的文件直接重命名,然后把 patch 的新文件用原来的名字保存到这个目录下,重启手机后生效。但是直接写文件是不行的,会遇到 Read-only file system 的错误,所以要 remount,命令行是mount -o remount rw /system/注意在 Android Emulator 下面的话重启之后就还原了,只能在真机上这么做。

2010-12-09 13:42:00 3808 1

转载 Android APK 是怎么安装的?

<br />http://justanapplication.wordpress.com/2009/08/22/a-standalone-android-runtime-application-installation/<br /> <br />It turns out that an application can be installed, such that it can subsequently be run, simply by placing the package containing

2010-12-08 18:34:00 1637

原创 点评 Firefox 导入 IE Cookie 的代码

<br />Firefox 在安装完成的时候,会问你要不要导入其它浏览器的数据,比如说导入 IE 的 cookie, history 之类。导入的代码在<br />browser/components/migration/src/nsIEProfileMigrator.cpp<br />其中,导入 cookie 的代码是:<br />/* Fetch and translate the current user's cookies. Return true if successful. */ns

2010-12-06 10:19:00 2828

原创 在 Android Emulator 中开发 LKM 程序

在 Android Emulator 里面用 insmod 安装 LKM 时,会报告错误,例如:# insmod hello.koinsmod: init_module 'hello.ko' failed (Function not implemented)这是因为 Android SDK 里面自带的 Emulator 所用的 kernel 关闭了加载 LKM 的功能。要在 Emulator 里面开发和调试 LKM,必须自己重新编译 kernel. 编译方法可以参考 http://linuxclue

2010-12-03 19:53:00 8985

原创 用 Android NDK 开发 Native 应用程序(二)

调试1. 首先把要调试的程序上传到模拟器中。假定我们用 adb push hello /data/hello 将程序传到了模拟器的 /data 目录。注意确认 hello 有可执行权限。2. 在模拟器上运行 gdbserver : hello,启动调试。其中 port 是 gdbserver 在手机上监听的端口号,注意和后面我们用 gdb 连接的端口可能不是同一个。运行结果可能是:# gdbserver :6789 helloProcess hello created; pid = 277Liste

2010-12-02 17:34:00 3753

原创 用 Android NDK 开发 Native 应用程序(一)

编译 Native App1. 安装 Android NDK,不必赘述。假定我们安装到了 /Developer/android-ndk-r4b/.2. 在工作目录下建立一个 jni 目录。如果要使用 NDK 自带的 Android.mk,必须叫做这个名字,否则 make 的时候会找不到文件,错误提示可能类似下面:Android NDK: Could not find application project directory ! Android NDK: Please define the

2010-12-02 17:10:00 21783

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除