How do I get the build.prop
values that are found in /system/build.prop
without root access? How do I edit them?

- 16,699
- 17
- 91
- 134
-
1http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties – samus Sep 27 '13 at 21:07
8 Answers
You can probably consider using SystemProperties.get("someKey")
as suggested by @kangear in your application using reflection like:
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;
}
And then you can use it any where like:
getSystemProperty("someKey");

- 7,661
- 4
- 30
- 55
Try This
static String GetFromBuildProp(String PropKey) {
Process p;
String propvalue = "";
try {
p = new ProcessBuilder("/system/bin/getprop", PropKey).redirectErrorStream(true).start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
propvalue = line;
}
p.destroy();
} catch (IOException e) {
e.printStackTrace();
}
return propvalue;
}

- 101
- 1
- 3
Such as:
SystemProperties.get("ro.rksdk.version")

- 2,493
- 2
- 31
- 44
-
-
This is rather for AOSP development than normal app development. Just import `android.os.SystemProperties`. – xdevs23 Apr 17 '16 at 13:38
Does System.getProperty()
help? As an alternative, you can execute getprop
in a Process
and retrieve its output.

- 16,699
- 17
- 91
- 134

- 26,870
- 17
- 81
- 104
-
1Not sure... it does not retrieve properties in my `/system/build.prop`. – Cristian Mar 30 '12 at 04:48
-
1Do you see the property when you do `adb shell getprop` on the command prompt? – Dheeraj Vepakomma Mar 30 '12 at 04:58
-
@BinoyBabu, As an alternative, you can execute `getprop` in a [Process](http://developer.android.com/reference/java/lang/Process.html) and get retrieve its output. – Dheeraj Vepakomma Mar 30 '12 at 06:48
-
I have checked multiple devices including some Samsung and LG devices as well as a Nexus 4, latest one was the Nvidia Shield Tablet with Android 6.0. On all devices ll on /system/build.prop gave me this result(of course with varying size and date of build.prop):
-rw-r--r-- root root 3069 2015-10-13 21:48 build.prop
This means that anyone and any app without any permissions can read the file. Root would only be required for writing the non "ro."-values. You could just create a new BufferedReader(new FileReader("/system/build.prop")) and read all lines.
Advantages of this approach:
- no need for reflection (SystemProperties.get)
- no need to spawn a Process and executing getprop
Disadvantages:
- does not contain all system properties (some values e.g. are set at boot only available at runtime)
- not handy for getting a specific value compared to SystemProperties.get

- 559
- 5
- 21
use android.os.Build class, see http://developer.android.com/reference/android/os/Build.html, but you can not edit it without root access.

- 188
- 2
- 8
On the setting page of your file manager, set home as /system, then you could browse system folders and copy build.prop and paste to sdcard. I'm still trying to root my phone but I have no problem tweaking on the way (no pun).

- 101,349
- 31
- 229
- 260

- 11
- 1
To read properties using reflection on the hidden API :
static public String getprop(String key){
try { Class c = Class.forName("android.os.SystemProperties");
try { Method method = c.getDeclaredMethod("get", String.class);
try { return (String) method.invoke(null, key);
} catch (IllegalAccessException e) {e.printStackTrace();}
catch (InvocationTargetException e) {e.printStackTrace();}
} catch (NoSuchMethodException e) {e.printStackTrace();}
} catch (ClassNotFoundException e) {e.printStackTrace();}
return null;
}
To edit them (Root required) manually, you should extract them with adb :
adb pull /system/build.prop
Edit them on the computer, then "install" the new build.prop :
adb push build.prop /sdcard/
adb shell
mount -o rw,remount -t rootfs /system
cp /sdcard/build.prop /system/
chmod 644 /system/build.prop
Would be safer to keep an original build.prop copy.

- 703
- 6
- 17
-
Can you expand your comment on how to use reflection in this particular case? – not2qubit Dec 16 '16 at 07:23
-
1SystemProperties.get() isn't accessible like other method, it has been hidden. In order to "unhide it", we must cast a neutral Class with Class.forName("android.os.SystemProperties"), extract it's method and invoke it. – J.Jacobs Dec 18 '16 at 08:55