android shell内容查询错误

时间:2016-07-15 21:25:34

标签: android adb

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

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

返回以下错误

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

1 个答案:

答案 0 :(得分:3)

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

这是您更新的命令应该是什么样的:

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

希望这有帮助。