I cannot run run-as (or ndk-gdb) for the Galaxy S4 running Jellybean 4.2.2.
~ $ adb shell
shell@android:/ $ run-as a.b.c ls
run-as: Package 'a.b.c' is unknown
There are multiple answers for this issue for pre-ICS devices, but those seem to have been fixed in ICS.
Update - Aug 2013: After initially appearing on the Galaxy S4 with Jellybean 4.2.2, the run-as issue now seems to be on all 4.3 devices. See this Android bug.
See the acknowledged Android issue here.
Update - Nov 2013: Google posted the patches that fix run-as in Android 4.4.
Found success by adding this to the activity:
Then I wrapped startGdbServer in an Android service and updating the ndk-gdb script to start the server instead of the run-as command.
Here's the manifest addition:
Here are the relevant ndk-gdb changes (in python):
There is a known issue with the latest version of Nexus 7. Simply downgrade to 4.2 (or get 4.3 without the mini-update) and you should be fine. There's a discussion here about it:
http://code.google.com/p/android/issues/detail?id=58373
One thing that ended up fixing my Nexus 7 from doing this, is installing different ADB drivers. I also re-flashed the device (though I am not sure if this was indeed what fixed it). As mentioned in another answer (mine) was that rooting would be required - when in fact, it did not help in my case either.
In my case it was a problem of core app:
Package which have in
AndroidManifest.xml
in<maninfest>
tagcoreApp="true"
are excluded from/data/system/packages.list
and thus really unknown forrun-as
.