您的位置:首页 > 运维架构

关于SystemProperies的注意事项

2013-09-18 15:06 211 查看
在使用SystemProperties时出现了开机后不断重启的问题,看log 筛选system android 找到
E/AndroidRuntime(14952): at android.os.SystemProperties.get(SystemProperties.java:64)
然后查看Framework源码SystemProperties.java:64,定位到如下位置:
/**
* Get the value for the given key.
* @return if the key isn't found, return def if it isn't null, or an empty string otherwise
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static String get(String key, String def) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
return native_get(key, def);
}

原来SystemProperties的key长度不能超过30字节。自此问题解决
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: