Link to home
Start Free TrialLog in
Avatar of hongning2009
hongning2009

asked on

Android Emulator adb - permission denied

I installed android studio 2.3 and trying to run adb on an emulator

I did adb -e shell

Its gives me prompt:

generic_x86:/

I do an ls and I show a bunch of directory  permission denied
 
I entered cd /data/data and it worked

after I entered

mkdir com.example.dbexample

and I get permission denied.

What is wrong?  I am expecting and android emulator you have root permission

Emulator is version 7.1.1
Avatar of Jackie Man
Jackie Man
Flag of Hong Kong image

What is wrong?  I am expecting and android emulator you have root permission

No. You need to run the command below first.

adb root
Avatar of hongning2009
hongning2009

ASKER

I did adb root

it returned back to dos prompt

I did adb -e shell

did an ls

still see the permission denied
I see. Android 7 needs to do more for rooting.

How to root android emulator (Android 7.1.1/ Nougat)

I’m pleased to inform the community of an easier way to root android emulator (run from standalone Android SDK)

Requirements:

SuperSU app (chainfire) latest version 2.82
Recovery flashable.zip (contains su binary)
Instructions

Install the SuperSu.apk

Install the SuperSu app firstly, just do drag and drop (if running latest emulator version or sideload through adb i.e adb –e install supersu.apk)
After installing it, when you run it shows a screen as shown below indicating “There is no SU binary installed..”. This error just confirms the device is not yet rooted.
enter image description here

Make emulator’ system partition writable

As it suggests, we need to give the emulator permission to write system files.
Type the following code to accomplish this: emulator.exe –avd {emulator_name} –writable-system

Source: https://android.stackexchange.com/questions/171442/root-android-virtual-device-with-android-7-1-1
If you are no further questions, please do a favor to close this question.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of hongning2009
hongning2009

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The previous solution was too complicated and is not practical to do considering its a testing for an emulator other forums suggest that it will not work anyway, so I decided to look for other selection