WEB开发网
开发学院手机开发Android 开发 Android HAL 阅读

Android HAL

 2010-04-21 06:36:00 来源:WEB开发网   
核心提示:if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {LOGE("ERROR: GetEnv failed");goto fail;}assert(env != NULL);if (registerMethods(env) !=

if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {

LOGE("ERROR: GetEnv failed ");

goto fail;

}

assert(env != NULL);

if (registerMethods(env) != 0) {

LOGE("ERROR: PlatformLibrary native registration failed ");

goto fail;

}

/* success -- return valid version number */

result = JNI_VERSION_1_4;

fail:

return result;

}

Android.mk 文件:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

#LOCAL_MODULE_TAGS := eng

# This is the target being built.

LOCAL_MODULE:= libled_runtime

# All of the source files that we will compile.

LOCAL_SRC_FILES:=

com_hello_LedService.cpp

# All of the shared libraries we link against.

LOCAL_SHARED_LIBRARIES :=

libandroid_runtime

libnativehelper

libcutils

libutils

libhardware

# No static libraries.

LOCAL_STATIC_LIBRARIES :=

# Also need the JNI headers.

LOCAL_C_INCLUDES +=

$(JNI_H_INCLUDE)

# No specia compiler flags.

LOCAL_CFLAGS +=

# Don't prelink this library. For more efficient code, you may want

# to add this library to the prelink map and set this to true.

LOCAL_PRELINK_MODULE := false

include $(BUILD_SHARED_LIBRARY)

将 Led stub , LedService 相关文件放到 development/my_module 分别 make 即可生成相应的 so 文件。使用 adb push 命令安装到虚拟机上运行即可。

文件组织机构如下:

a@ubuntu:~/work/android/source_android/development/my_module$ pwd

/home/a/work/android/source_android/development/my_module

a@ubuntu:~/work/android/source_android/development/my_module$ tree hal

hal

上一页  4 5 6 7 8 9 10  下一页

Tags:Android HAL

编辑录入:coldstar [复制链接] [打 印]
赞助商链接