Warning for Windows Users
In June, 2023, this project stopped working for Windows users.I recommend doing this project instead:
Mac Users
In a Terminal, execute these commands:If you see an error message saying "command not found", execute this command to fix the Path:
git clone https://github.com/newbit1/rootAVD.git cd rootAVD adb devicesThen execute this command again:
export PATH=$PATH:~/Library/Android/sdk/platform-tools
adb devices
You should see your device listed, as shown below.
Windows Users In a Web browser, go to
https://github.com/newbit1/rootAVD
Click the Code button. Click "Download ZIP", as shown below.
At the bottom of your Windows desktop, click the yellow folder icon to launch File Explorer.
Open your Downloads folder. Right-click the rootAVD-master.zip file and click "Extract All...," Extract.
Open a Command Prompt window and execute these commands:
If you see an error message saying "Not found: adb", close the Command Prompt window.
cd Downloads cd rootAVD-master cd rootAVD-master adb devicesOpen an Administrator Command Prompt window and execute this command to fix the Path:
Close the Administrator Comand Prompt window and open a normal Comand Prompt window.
setx /M PATH "%PATH%;%userprofile%\appdata\local\android\sdk\platform-tools"Then execute these commands:
cd Downloads cd rootAVD-master cd rootAVD-master adb devices
Mac Users
In a Terminal, execute these commands:You see a long list of commands for many Android versions.
./rootAVD.sh ListAllAVDsExecute the command with the correct API number for your emulator, which is probably API 30, x86, ending in "ramdisk.img", as shown below:
If the script works perfectly, Aa lot of messages scroll by, as shown below, and your emulator shuts off.
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis_playstore/x86/ramdisk.imgIf it hangs on "Trying to install Apps/*", stop it with Ctrl+C.
Windows Users In the Command Prompt, execute this command:
You see a long list of commands for many Android versions. Execute the correct one for your emulator, which is probably API 30, x86, ending in "ramdisk.img", as shown below:
rootAVD.bat ListAllAVDsA lot of messages scroll by, and your emulator shuts off.
rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis_playstore\x86\ramdisk.img
If the device fails to boot up, you may need to repeat the cold boot process.
Tap the Magisk app, as shown below.
Click Install, as shown below.
If you see a message saying you need to allow it to install from unknown sources, approve that.
In the "Install unknown apps" page, click the slider next to "Allow from this source", as shown below.
Then click the back-arrow.
Click Install.
In a Command Prompt or Terminal, execute these commands:
adb shell
su
A prompt appears on your Android device,
as shown below.
Click GRANT.
You get a root shell, as shown below.
Troubleshooting
If you are too slow, you need to open Magisk on your emulator.Follow prompts on your screen--you may need to reboot your phone and launch Magisk again.
In Magisk, there's an option to approve root access again. I think it's at the bottom of the main screen.
M 142.1: id (15 pts)
In your root shell, execute this command:Find the text covered by a green box in the image below. That's the flag.
id
Posted 10-7-22
PATH command fixed 10-17-11
Minor updates to instructions 3-13-23
Magisk update processed added 6-21-23
Referral to M 145 added 7-1-23