Android系统源码frameworkSystemUI导⼊eclipse编译
导⼊SystemUI到eclipse
SystemUI路径: repo/frameworks/base/packages/SystemUI/
⼀、通过Android.mk⽂件查依赖库
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
src/com/android/systemui/EventLogTags.logtags
LOCAL_STATIC_JAVA_LIBRARIES := Keyguard \
android-support-v4
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_PACKAGE_NAME := SystemUI
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_RESOURCE_DIR := \
frameworks/base/packages/Keyguard/res \
$(LOCAL_PATH)/res
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.android.keyguard
ifneq ($(SYSTEM_UI_INCREMENTAL_BUILDS),)
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_JACK_ENABLED := incremental
endif
include frameworks/base/packages/SettingsLib/common.mk
eclipse androidinclude $(BUILD_PACKAGE)
#ifeq ($(EXCLUDE_SYSTEMUI_TESTS),)
#    include $(call all-makefiles-under,$(LOCAL_PATH))
#endif
其中LOCAL_STATIC_JAVA_LIBRARIES为引⽤的静态库(静态库是需要编译进apk的)
静态库有: Keyguard android-support-v4
LOCAL_JAVA_LIBRARIES为⾮静态库(⾮静态库是Android系统⾃带的库)
⾮静态库有: telephony-common
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.android.keyguard(合并keyguard的资源⽂件)其中Keyguard和SettingsLib是包含res的⼯程库,因此不能导⼊jar包
从Android.mk⽂件得出结论是:
systemUI依赖SettingsLib和keyguard两个⼯程(带有res⽂件),和telephony-common和android-support-v4两个jar包
⼆、查对应的jar和源码
导⼊SettingsLib源码
路径: /msm8976/repo/frameworks/base/packages/SettingsLib/
(1). 将SettingsLib导⼊Eclipse,根据import报错,需要framework.jar,通过UserLibraries⽅式导⼊framework.jar(同时需要配置优先使⽤这个库(top⼀下))如下图
framework.jar的路径:
/msm8976/repo/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar修改名字即可
(2). 根据如下报错到对应源码,然后在/msm8976/repo/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/下到class.jar,修改名字即可
报错代码路径: /msm8976/repo/libcore/luni/src/main/java/libcore/icu
SettingsLib报错解决,把SettingsLib设置成Is Library
导⼊Keyguard源码
路径: /msm8976/repo/frameworks/base/packages/Keyguard
(1).同上导⼊framework.jar
(2).根据报错发现需要依赖SettingsLib⼯程
(3)minSdkVersion和targetSdkVersion修改成23
Keyguard报错解决,把Keyguard设置成Is Library
SystemUI引⽤SettingsLib和Keyguard源码
SystemUI同上导⼊framework.jar
根据以下报错,SystemUI同上导⼊libcore.jar
根据以下报错,导⼊telephony-common.jar
telephony-common路径:
/msm8976/repo/out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar修改名字即可
根据以下报错,缺失EventLogTags.java,在源码从搜索对该类复制到SystemUI对应包下(/com/android/systemui/EventLogTags.java)
clean⼀下,SystemUI报错全部解决完成,能够在windows下编译出apk,Eclipse默认签名的apk就构建完成了

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。