Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio 2015, android command 'run-as' failed

The environments: windows 10(home, pro), visual studio 2015(community, professional) all combination.

Start visual studio 2015 update 1, new project, Native-Activity Application(Android), thus make default android native app. Build solution and start debugging. Then such error message is presented:

Error message.

Unable to start debugging. Android command 'run-as' failed. Package 'com.Android1' is unknown.

I googled, but cannot find how to solve. What I missed? How to set up my environments, or fix something?

like image 549
JinMin Choi Avatar asked Mar 09 '16 13:03

JinMin Choi


2 Answers

The solution to this is that you must root your device and fix a file permission. You can try following the advice on the prompt (especially if rooting is not an option) but in some cases only a root will fix the issue.

Once you have rooted your device open an adb shell and run the following:

su
mount -o remount,rw /system
chmod 4750 /system/bin/run-as
mount -o remount,ro /system

This fixes the setuid permission so that the run-as process is granted access based on the owner of the file (i.e. root).

like image 184
James Oltmans Avatar answered Nov 02 '22 22:11

James Oltmans


I had a very similar issue on Samsung Galaxy S6 Edge, trying to start debugging on VS2015, I got a different error, much less verbose than in the attached screenshot:

run-as: Could not set capabilities: Operation not permitted

Based on the contents of the attached screenshot above, I tried 'initializing' / factory resetting the device using Samsung's Smart Switch and it actually fixed the 'run-as' issue I was having.

like image 26
Giedrius Avatar answered Nov 02 '22 23:11

Giedrius