简体   繁体   中英

Android studio - /system/bin/sh: Permission Denied

In Android Studio, i want 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 try: 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.

I have found why it not working. Because pm manager is disabled.

For resolve this issue:

  1. Connect your phone to the pc
  2. Open a command line and write adb shell and press enter
  3. Write su and press enter
  4. Now write chmod 777 /system/bin/pm

Enjoy!

You do this using adb

adb root (root access)

adb shell (Enter as root)

mount -o rw,remount / (for permission write access)

rm system/app -r Instagram (remove folder)

rm system/app -r Instagram/instagram.apk (remove apk)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM