Issue
In Android Studio, I want to run my app in my device but I have an error message:
$ adb shell pm install -r "/data/local/tmp/my.model" /system/bin/sh: pm: can't execute: Permission denied
(It launch perfectly in emulator with 0 error.)
I have a Samsung S3 Mini rooted phone. My phone is visible with command adb devices
.
I have tried: run Android Studio in administrator, add ADB
path on environment variable, remove build folder and rebuild project, but I have always this error.
I guess that's why it does not start my Activity.
$ adb push C:\Users\me\AndroidStudioProjects\Model\app\build\outputs\apk\app-debug.apk /data/local/tmp/my.model
$ adb shell pm install -r "/data/local/tmp/my.model"
/system/bin/sh: pm: can't execute: Permission denied
$ adb shell am start -n "my.model/my.model.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "my.model/my.model.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=my.model/.MainActivity }
Error type 3
Error: Activity class {my.model/my.model.MainActivity} does not exist.
Error while Launching activity
Where is the issue? Thank you.
Solution
I have found why it is not working. Because pm manager is disabled.
To resolve this issue:
- Connect your phone to the pc
- Open a command line and write
adb shell
and press enter - Write
su
and press enter - Now write
chmod 777 /system/bin/pm
Enjoy!
Answered By - P. Frank Answer Checked By - David Goodson (WPSolving Volunteer)