1.进入android源码目录下的build下执行:source envsetup.sh 后继续在该路径下执行lunch。
2.编写完成工程
3.编写Android.mk文件,放入工程目录下
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := helloworld
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := helloworld
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
4.编译
拷贝工程至packages/apps/下
~$ cp -rf helloworld ~/android/packages/apps/helloworld
进入目录 ~/...../helloworld$ mm
编译成功:out/target/product/product_name/system/app/helloworld.apk
4、运行
安装在机子上运行之。 adb install xxx/helloworld.apk