如何获取 build.prop 值?

Bin*_*abu 4 android

如何获取build.prop/system/build.prop没有 root 访问权限的情况下找到的值?我如何编辑它们?

Kam*_*med 7

您可能可以考虑使用SystemProperties.get("someKey")@kangear 在您的应用程序中使用反射的建议,例如:

public String getSystemProperty(String key) {
    String value = null;

    try {
        value = (String) Class.forName("android.os.SystemProperties")
                .getMethod("get", String.class).invoke(null, key);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return value;
}
Run Code Online (Sandbox Code Playgroud)

然后你可以在任何地方使用它:

getSystemProperty("someKey");
Run Code Online (Sandbox Code Playgroud)


Dhe*_*.S. 3

System.getProperty()帮助吗?作为替代方案,您可以getprop在 a 中执行Process并检索其输出。