今天在frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java引用到了mtk自定义的类alps\mediatek\frameworks\base\media\audio\java\com\mediatek\audioprofile\AudioProfileManager.java ,编译的时候提示如下错误:
frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java:965: cannot find symbol symbol : class AudioProfileManager location: class com.android.internal.policy.impl.GlobalActions.SilentModeTriStateAction private AudioProfileManager mProfileManager;
/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java frameworks/base/packages/SystemUI/src/com/mediatek/systemui/statusbar/toolbar/QuickSettingsConnectionModel.java
看一下GlobalActions.java的路径,发现它隶属于policy下面,在policy下面发现一个Android.mk文件。这个就比较有意思了,可以发现这个文件中并未引用AudioProfileManager类的库,所以在Android.mk中添加如下内容即可:
LOCAL_PATH:= $(call my-dir) # the library # ============================================================ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-java-files-under, src) <span style="color:#ff0000;">#add by yourself在这个地方添加引用函数所在的库 LOCAL_JAVA_LIBRARIES := mediatek-framework</span> LOCAL_MODULE := android.policy include $(BUILD_JAVA_LIBRARY) # additionally, build unit tests in a separate .apk include $(call all-makefiles-under,$(LOCAL_PATH))