android shell 内容查询错误

kan*_*nna 1 android adb

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

adb shell content query --uri content://settings/system --projection name:value --where "name='user_rotation'"
Run Code Online (Sandbox Code Playgroud)

返回以下错误

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)
Run Code Online (Sandbox Code Playgroud)

虽然我可以得到所有条目,

adb shell content query --uri content://settings/system
Run Code Online (Sandbox Code Playgroud)

小智 5

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

更新后的命令如下所示:

adb shell content query --uri content://settings/system --projection name:value --where 'name=\"user_rotation\"'
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助。