Android Go Launcher3使用SystemProperties模块编译报错
解决方案
- 修改Android.mk
将Android.mk中LOCAL_SDK_VERSION := current
注释掉
#LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 21
LOCAL_PACKAGE_NAME := MtkLauncher3Go
LOCAL_PRIVILEGED_MODULE := true
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3Go MtkLauncher3
- 通过反射机制
public static String getSystemProperty(String property, String defaultValue) {
try {
Class clazz = Class.forName("android.os.SystemProperties");
Method getter = clazz.getDeclaredMethod("get", String.class);
String value = (String) getter.invoke(null, property);
if (!TextUtils.isEmpty(value)) {
return value;
}
} catch (Exception e) {
Log.d(TAG, "Unable to read system properties");
}
return defaultValue;
}
作者:小的橘子
链接:https://www.jianshu.com/p/6d374ebfa91f
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。