Android 7.0系统源码中如何编译android studio工程
程序员文章站
2022-07-12 11:48:34
...
eclipse工程放在系统源码里编译,直接把整个包丢到系统里,然后加一个Android.mk,就完事了,可是eclipse被谷歌抛弃很久了,现在琢磨者如何将android studio工程放到系统源码里编译,在网上找了一大圈 都没有找到,只好自己干了了。
android studio moudel目录是这样的结构
我的方法是这样的:
1.在packages/apps 目录下新建一个MyTest ,把src/main/目录下的文件全部拷到MyTest目录下
2.新建Android.mk ,这个是参考Setting里的android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v4 \
android-support-v7-recyclerview \
android-support-v7-preference \
android-support-v7-appcompat \
android-support-v14-preference \
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
frameworks/support/v7/preference/res \
frameworks/support/v14/preference/res \
frameworks/support/v7/appcompat/res \
frameworks/support/v7/recyclerview/res \
LOCAL_AAPT_FLAGS := --auto-add-overlay \
--extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview
LOCAL_PACKAGE_NAME := MyTest
include $(BUILD_PACKAGE)
3.记得在device.mk里加上一句话
PRODUCT_PACKAGES +=MyTest