Set permission
Running the adb command to set the permission results in a 'no permission specified' error. Google seems to agree with the command itself, so I suspect a wrong id?
Hmm... it should work. Are you sure you didn't misspell anything?
adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS
Also, what version of Android?
I presume the error was misreading the command. It appears as 3 lines when displayed by the app, given my screen resolution and font size. It is really all on a single line. Here a slight alternative: Open a DOS window by pressing the "Windows" key then typing "cmd" then enter. Use "cd /folder_to_adb.exe" Type "adb devices" If your phone is recognized; Type "adb shell" and enter
You are now in an interactive linux style shell executing in your phone. Type: "pm grant com.dp.logcatapp android.permission.READ_LOGS"
pm is a command which will read 3 parameters grant is the first parameter com.dp.logcatapp is the second parameter. It is the internal name that identify the app Finally, the third parameter is the name of the permission.
This works without needing root. The app, after restart, immediately print all those log lines. Thanks for sharing the source code.
Do I have to restart the app or my device? Is there a possibility to show in Logcat Reader if READ_LOGS is already granted?
I sent the command with adb and got no error, so I guess it worked. But Logcat doesn't show logs from other apps.
Huawei P20 Pro with Android 9.
same issue with Motorola G7 here
$ adb shell dumpsys package com.dp.logcatapp | grep permission
requested permissions:
android.permission.READ_LOGS
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.FOREGROUND_SERVICE
install permissions:
android.permission.FOREGROUND_SERVICE: granted=true
android.permission.READ_LOGS: granted=true
runtime permissions:
You need to kill the app and restart it too :
adb shell am force-stop com.dp.logcatapp
adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS
Hmm... it should work. Are you sure you didn't misspell anything?
adb shell pm grant com.dp.logcatapp android.permission.READ_LOGSAlso, what version of Android?
Thanks, I had the same error and thanks to your example I realized that my error was due to the missing space between the package name and the word "android..."