How can I overcome the adb shell setprop resource length limit,

I get an error when trying to set a value for a property with name> = 32 characters

adb shell setprop 01234567890123456789012345678901 VALUE 

Mistake:

 could not set property 

It works great

 adb shell setprop 0123456789012345678901234567890 VALUE adb shell getprop 0123456789012345678901234567890 VALUE 

Is there a way to set properties with longer names?

+11
android properties
Feb 21 '11 at 16:13
source share
4 answers

It seems that this restriction will not be. I see the same rules in javascript sources for Android.

 public class SystemProperties { public static final int PROP_NAME_MAX = 31; public static final int PROP_VALUE_MAX = 91; ... } 
+10
Feb 21 '11 at 16:57
source share

I also had the same problem. since the answer above is not possible, use a NAME that is greater than 31. so I change the package name to a shorter than 31, and now it works.

+2
Jul 08 '14 at 7:32
source share

Is redirection possible?

Set a small property that will contain the file name for the conf file:

 setprop confFileName "myConf.yml" 

this conf file has all your big property names and values.

0
Jul 14 '15 at 8:22
source share

Update: In Android O, the 32-character system property name limit has been removed. Now you can have longer names.

 public class SystemProperties { /** * Android O removed the property name length limit, but com.amazon.kindle 7.8.1.5 * uses reflection to read this whenever text is selected (http://b/36095274). */ public static final int PROP_NAME_MAX = Integer.MAX_VALUE; public static final int PROP_VALUE_MAX = 91; ... } 
0
Jan 15 '19 at 14:39
source share



All Articles