androidshell内容查询错误

android shell content query error

我正在尝试使用 content query 命令获取系统设置。 例如:

adb shell content query --uri content://settings/system --projection name:value --where "name='user_rotation'"

Returns 出现以下错误

Error while accessing provider:settings
android.database.sqlite.SQLiteException: no such column: user_rotation (code 1): , while compiling: SELECT name, value F
ROM system WHERE (name=user_rotation)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:181)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:420)
        at com.android.commands.content.Content$QueryCommand.onExecute(Content.java:535)
        at com.android.commands.content.Content$Command.execute(Content.java:417)
        at com.android.commands.content.Content.main(Content.java:605)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

我可以获得所有条目,

adb shell content query --uri content://settings/system

我 运行 遇到了类似的错误,发现转义内部引号解决了我的问题。尝试将 --where "name='user_rotation'" 更改为 --where 'name=\"user_rotation\"'.

更新后的命令应如下所示:

adb shell content query --uri content://settings/system --projection name:value --where 'name=\"user_rotation\"'

希望对您有所帮助。