yashsingh1/xdaforums huggingface dataset:
[Android Studio] newbit:
API 28 is PIE, Google changed the ramdisk location to SAR Partition.

The Qemu Engine does have a ramdisk.img, but it is not used by it!!

Therefor the rootAVD script succeeded, but Qemu is ignoring the ramdisk.img anyway. -> No Root

You could try to force qemu using it by passing it as boot parameter, I never tried this.

I thought this app is running the apps in question independent of the safety state, that is what I figured. Perhaps I am wrong, then ignore it.
[Android Studio] baribalbear:
I tried to boot emulator with -ramdisk parameter and pointed to patched file - no luck, it boots but magisc manager don't see root.

What is changed in Android 10 comparing to Android 9 that it started to work with the patching script?
[Android Studio] newbit:
It seems that since Android 10, qemu is using the ramdisk.img file again.
[Android Studio] QuilLeeR:
hello i am new to this, after downloading the zip file what do i have to do? i was trying to open the .bat but it closes immediately and does not do the rooting process

edit: I ran the script but it doesn't work does anyone know what I'm doing wrong, I tried it on both android 11 and 12

View attachment 5262883
[Android Studio] newbit:
Hey @QuilLeeR,

it is possible that you didn't meet all the preconditions for rootAVD. So, first things first:

Have the AVD running

Have a command prompt open

make sure if you run adb shell it will connect to the running AVD

If you have all above checked, run rootAVD.bat with appropriate argument.

For Android 11 (R):

rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis_playstore\x86_64\ramdisk.img

For Android 12 (S) rev 1 and rev 2:

rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-S\google_apis_playstore\x86_64\ramdisk.img

On Android 12 (S), you have to run the script a second time, after the shutdown and restart!

The Magisk App doesn't find its Deamon running, and shows no root. - But you can grant root if you request it!

adb shell

su

Hence, it doesn't trigger the additional setup. Hence, you need to run the script twice.

Since Android 12 (S) rev 2, the Magisk Daemon is not running when the AVD is booted.

To solve this, you need to install a Canary Version. Which you can now choose during the installation process.

Cheers

NewBit
[Android Studio] QuilLeeR:
hello, now it works perfect in android 12, I think I was restarting it wrong, if I understand correctly I had to shut down, restart "android studio" and enter again to start rootAVD.bat for the second time. thank you very much for your help

View attachment 5263491
[Android Studio] newbit:
Well, you don't have to restart the entire Studio, just the AVD. And yes, shutdown and start is mandatory, only rebooting

doesn't pick up the patched ramdisk.img

I am glade it worked eventually.

Just for improvement purposes.

Did I hint it not well enough? What was missing?

Or was it just a misreading/misunderstanding on your side?

I would like to keep the Notes for the script as clear as possible.

Also, there is always some space to the top left.

Cheers

NewBit
[Android Studio] QuilLeeR:
you explained it correctly when I consulted you because the steps you gave me were not included from the beginning and maybe for someone who does not understand a lot, they are lost like me but I hope that with the answer to my question someone else can understand the process and I think it was my mistake, maybe I was writing something wrong, maybe I misspelled the ramdisk path
[Android Studio] newbit:
Ok, thanks for your feedback. I've updated the README.md accordingly.
[Android Studio] itsLazR:
Hey I am having an issue running the code -- I can push apks, just not patching ramdisk.img. Running in git bash because CMD/PS couldn't get past the ADB Shell. (even though adb shell command works)

Android Studio Version - 2021.2.1 - Chipmunk

Host - Windows 10

AVD - API 31 (S) x86_64 (Google Play)

xxcmb@DESKTOP-BSKUQJ6 MINGW64 ~/Desktop/rootAVD-master
$ ./rootAVD.sh C:/Users/xxcmb/AppData/Local/Android/Sdk/system-images/android-31/google_apis_playstore/x86_64/ramdisk.img
[!] and we are NOT in an emulator shell
[*] Set Directorys
[-] Test if ADB SHELL is working
[-] In any AVD via ADB, you can execute code without root in /data/data/com.android.shell
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
mkdir: 'C:/Program': No such file or directory
mkdir: 'Files/Git/data/data/com.android.shell/Magisk': No such file or directory
[-] Magisk installer Zip exists already
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-]
[-] ramdisk.img Backup exists already
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-]
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-]
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
sh: C:/Program: No such file or directory
[Android Studio] newbit:
Hi @itsLazR,

my apologies for the late response.

The Log from the windows git-bash looks weird, seems

there are issues with the space in the directory path.

I've never tried the script with windows git-bash, don't think

this will work. But if you show me your windows cmd logs,

I can probably help you more with that.
[Android Studio] itsLazR:
Ah, I was using a different ADB folder I had previously gotten -- I think from this thread years ago. Setting it to Android Studio's folder worked. I wasn't able to install Magisk* latest via the script but the one included with the repo worked! Thank you!
[Android Studio] MrSpuf:
Hey @newbit thanks for your work, amazing thing you did with this one.

There is no way for a work around in Android Pie (28)?
[Android Studio] newbit:
Not to my knowledge, no. If you find a way, please let me know.
[Android Studio] noobsinistro:
@newbit is there any way to put version 23.0 in the script? I can't go back to version 23 using magisk manager.
[Android Studio] newbit:
Sure, you can either download your desired version manually and put in the rootAVD folder. Or you can just start the script normal, and in the menu you can display all the available versions and choose the one you like. Fetching all the Magisk Versions can take some time, so be patience once you hit the button.
[Android Studio] liuxiriver:
Thanks a lot!
[Android Studio] rmccurdy:
Java Android Magisk Burp Objection Root Emulator Easy (JAMBOREE) **mic drop**

Thank you so much for RootAVD!

GitHub - freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy: Java Android Magisk Burp Objection Root Emulator Easy (JAMBOREE)

Java Android Magisk Burp Objection Root Emulator Easy (JAMBOREE) - freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy

github.com
[Android Studio] Peterlymo:
end here sdk api 23

[*] repacking back to ramdisk.img format
[!] Rename Magisk.zip to Magisk.apk
[Android Studio] newbit:
API 23 is Android 6. Not sure if this Version is still supported.

What is the full log incl. your start command?
[Android Studio] newbit:
So it is windows you are starting it with. From a power shell or cmd terminal?
[Android Studio] Peterlymo:
powershell in cmd
[Android Studio] newbit:
Dont use the powershell, just the cmd. See if it works.
[Android Studio] Kekleroni:
Hello, maybe Im a little bit late for this post but Im currently looking for a way to modify the Build.prop in a Googe API System Image. Rooting works with your script, but for some reason Im still unable to edit it. I Tried Build.prop Editor, ES File Explorer, Pulling and Pushing it through ADB and "ADB shell setprop ro.serialno" but everytime it returns that the /system/ is read-only. Is there anyway to get help from you? I would be so thankful.
[Android Studio] newbit:
Try MagiskHide Props Config Module for Magisk from @Didgeridoohan. It is the best module for this task.
[Android Studio] kreksa:
Hello. I am trying to install Magisk (latest version on site) on AVD (latest version) using virtual device without play market, i tested Pixel_4_XL and Pixel_3. And I installed Android 11 R (Google APIs) on them. Firstly I tried to run script with all preconditions done, I followed step by step the guide from youtube (

). But script always failes at work check of ADB shell. Then i tried steps to root device proposed in readme. As i understood and as its actually happened, doing it just gives a root for device, but not a magisk. And also this root disappeared after restart of avd. In the 2021 guides that I found, devices without Google Play were also used, but they had the adb shell check and Magisk installed. It looks like things have changed since then. Can I install Magisk now or am I just doing something wrong?
[Android Studio] newbit:
Hi,

this video is wrong. Take a look at the gifs i've provided.

If you are using Magisk >26.x you have to use the FAKEBOOTIMG argument.

If you just type adb shell, does it connect to the avd?

Please provide full logs incl. your command.
[Android Studio] kreksa:
This is logs

First CMD window:

C:\Users\swate> set PATH=%LOCALAPPDATA%\Android\Sdk\emulator;%PATH%

C:\Users\swate>emulator -list-avds

Pixel_3_XL_API_30

C:\Users\swate>emulator -avd Pixel_3_XL_API_30 -writable-syste

INFO | Android emulator version 32.1.12.0 (build_id 9751036) (CL:N/A)

INFO | Found systemPath C:\Users\swate\AppData\Local\Android\Sdk\system-images\android-30\google_apis\x86\

INFO | Storing crashdata in: C:\Users\swate\AppData\Local\Temp\\AndroidEmulator\emu-crash.db, detection is enabled

INFO | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.

unknown option: -writable-syste

please use -help for a list of valid options

C:\Users\swate>emulator -avd Pixel_3_XL_API_30 -writable-system

INFO | Android emulator version 32.1.12.0 (build_id 9751036) (CL:N/A)

INFO | Found systemPath C:\Users\swate\AppData\Local\Android\Sdk\system-images\android-30\google_apis\x86\

INFO | Storing crashdata in: C:\Users\swate\AppData\Local\Temp\\AndroidEmulator\emu-crash.db, detection is enabled

INFO | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.

WARNING | Please update the emulator to one that supports the feature(s): Vulkan

WARNING | System image is writable

INFO | IPv4 server found: 192.168.1.1

INFO | added library vulkan-1.dll

HAX is working and emulator runs in fast virt mode.

WARNING | *** No gRPC protection active, consider launching with the -grpc-use-jwt flag.***

INFO | Started GRPC server at 127.0.0.1:8554, security: Local, auth: none

INFO | Advertising in: C:\Users\swate\AppData\Local\Temp\avd\running\pid_4140.ini

INFO | Setting display: 0 configuration to: 1440x2960, dpi: 560x560

INFO | Boot completed

INFO | Increasing screen off timeout, logcat buffer size to 2M.

INFO | Revoking microphone permissions for Google App.

Second window

C:\Users\swate>set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%

C:\Users\swate>adb root

adbd is already running as root

C:\Users\swate>adb shell avbctl disable-verification

Successfully disabled verification. Reboot the device for changes to take effect.

C:\Users\swate> adb disable-verity

using overlayfs

Successfully disabled verity

Now reboot your device for settings to take effect

C:\Users\swate>adb reboot

C:\Users\swate>adb root

restarting adbd as root

C:\Users\swate>adb remount

remount succeeded

C:\Users\swate>adb shell

generic_x86:/ #

I didnt really get about fakebootimg. After this i opened third cmd window and tried this:

C:\Users\swate>cd /d D:\root\rootAVD-master

D:\root\rootAVD-master> .\rootAVD.bat FAKEBOOTIMG

rootAVD A Script to root AVD by NewBit XDA

.....

D:\root\rootAVD-master>rootAVD.bat ListAllAVDs

.......

D:\root\rootAVD-master>rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img

[*] Set Directorys

[-] Test if ADB SHELL is working

D:\root\rootAVD-master>
[Android Studio] newbit:
Oh ok i see your confusion now.

If you want to root a non playstore avd, you have two exclusive options.

1st. Use the built in root, the one you did in your first and second cmd window.

2nd. Use my script to install Magisk.

Don't mix both of them together.

So start over with a fresh installed AVD.

Make sure you have a stock ramdisk.

rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img restore

Boot up your AVD and test if you can connect via adb shell

If not, set your path like you did already with:

set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%

And test again if you can connect via adb shell.

If you finally can connect to the running AVD, run the script with:

rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img FAKEBOOTIMG

The script will pause for 60s and open Magisk, click on install, select the

fakeboot.img in the Download folder and let Magisk patch it.

After this, hit the Enter button on your terminal and the script finishes

the installation. Shortly after the AVD will shut down, and you can cold boot it.

Now Magisk should be installed, open it, and it should prompt you a toast message that it needs to finalise the installation and reboots the AVD.
[Android Studio] kreksa:
Sorry, I'm very confused :) So i runned this

D:\root\rootAVD-master>rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img restore

[*] Set Directorys

[*] Backups still remain in place

D:\root\rootAVD-master>adb shell

D:\root\rootAVD-master>set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%

D:\root\rootAVD-master>adb shell

generic_x86_64_arm64:/ $

As i can understand it, it is an adb shell. So I launched script and it got stuck again :(

D:\root\rootAVD-master>rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img FAKEBOOTIMG

[*] Set Directorys

[-] Test if ADB SHELL is working

D:\root\rootAVD-master>
[Android Studio] newbit:
Well, this confuses me too.

Perhaps there is an issue with the script.

Could you please add in the rootAVD.bat after the line 247 an @echo on?

Line 247: echo [-] Test if ADB SHELL is working
Line 248: @echo on

And then post me here again the log please.
[Android Studio] kreksa:
I was away for few hours, and started to trying solving the problem and got this.

D:\root\rootAVD-master>rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-30\google_apis\x86_64\ramdisk.img restore

[*] Set Directorys

Файл не найден (File is not found)

[*] Backups still remain in place

D:\root\rootAVD-master>

This happened once before. When you run the script, a message from Windows appears that it cannot be run on this computer. If you try to edit script, it will turn out that it is empty. At that time, I simply reinstalled it, not knowing that the file was empty, thinking it was a system error. But after I reinstalled it now, the same thing happened 5 minutes after reinstalling the script. My windows antivirus is disabled, I have no idea why this might be happening.
[Android Studio] kreksa:
all other files, including rootAVD.sh is not empty
[Android Studio] newbit:
You only need the restore argument to restore the stock ramdisk after you've patched it already. If you try to restore a fresh installes avd, there will be no backup from to restore to. Hence no (backup) file found.
[Android Studio] kreksa:
Sorry for being away for two days, I was very busy. I understand that if I restore a new file, it wont be restored, I did this in case Android Studio can be using already installed files from a deleted phone, if it doesnt delete files, maybe it's redundant. I attached the code, if it could affect the fact that in the end the file (script) for some reason turned out to be empty.

So I runned script with adb shell working and echo on. It was a little battered, but I tried to bring him to a readable form.

if ""adb" is not internal or external" == "true" (echo [-] ADB connectoin possible ) else (

echo."adb" is not internal or external | FIND /I "offline" 1>Nul && (

echo [^!] ADB device is offline

echo [*] no ADB connection possible

call :_Exit 2>nul

)

echo."adb" is not internal or external | FIND /I "unauthorized" 1>Nul && (

echo [^!] "adb" is not internal or external

echo [*] no ADB connection possible

call :_Exit 2>nul

)

echo."adb" is not internal or external | FIND /I "recognized" 1>Nul && (

if exist C:\Users\swate\AppData\Local\Android\Sdk\platform-tools\ (set ADB_DIR=Android\Sdk\platform-tools\ ) else (

echo [^!] ADB not found, please install platform-tools and add it to your %PATH%

call :_Exit 2>nul

)

for /F "delims=" %i in ('dir C:\Users\swate\AppData\Local\""adb.exe /s /b /a-d') do (set ADB_EX=%i )

if !ADB_EX! == "" (

echo [^!] ADB binary not found in %LOCALAPPDATA%\""

call :_Exit 2>nul

)

echo [^!] ADB is not in your Path, try to

echo set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%

call :_Exit 2>nul

)

echo."adb" is not internal or external | FIND /I "error" 1>Nul && (

echo [^!] "adb" is not internal or external

echo [*] no ADB connection possible

call :_Exit 2>nul

)

call :_Exit 2>nul

)

if 1 == 0 (cmd /k )

()
[Android Studio] kreksa:
As i saw script was trying to find the adb app, but its there
[Android Studio] kreksa:
So, I solved the problem :). I didn't think it was necessary to write a "set path" when I am trying to run a script, i wrote it only in other window of cmd, where I checked if adb works or not. I don’t know why my Windows doesn’t do it itself, in each new cmd window you need to manually set the commands, although it probably should be so. Sorry for bothering you and thanks a lot for your help!
[Android Studio] newbit:
Great. Yes set path is only valid for the current terminal session. But you can put this in your user profile as well. And it gets set every time you log into windows. Search for it, they are plenty guides in the net to do so.
[Android Studio] Devendra Bhatla:
'FIND' is not recognized as an internal or external command,

operable program or batch file.

Getting above when running rootAVD.bat @newbit
[Android Studio] newbit:
Please read the first post on how to ask for help.
[Android Studio] KingBlaze31104:
Host System:

Windows 11

Android Studio Version: Android Flamingo

AVD Version: Android 12.0 x86_64 Google Play

Magisk Version: Stable 25.2

Hey man can you help me out im trying to root android 12, but keep getting this. Oddly when trying android 13, it works perfectly fine but not android 12. Thanks.
[Android Studio] newbit:
No, not yet. I am working on it. This issue seems to be unreported to busybox, so couldn't get any hint from there. Still trying to figure out whats causes this issue.
[Android Studio] KingBlaze31104:
Thanks for the reply. Hopefully you can figure out the root of the problem soon. If anything comes up on the topic I figure you’ll make an announcement. 🙂
[Android Studio] newbit:
Should be fixed now...

Please report back if you tried it.
[Android Studio] KingBlaze31104:
Just tried, 100% working now. Thanks.
[Android Studio] lieuliau:
Hi @newbit , how to use this script to root Bluestacks 5.12 on Windows?
[Android Studio] newbit:
Dont know.

Never tried it on windows, nor on 5.1

Only on Mac, sry.
[Android Studio] lieuliau:
Can you please show me instruction for bluestacks on Mac? I will try on windows. Thank!
[Android Studio] newbit:
Check out the rootavd.sh script and follow the bluestacks argument.
[Android Studio] luluamaral:
hi. ti first stuck in:

PS C:\Users\lenovo\Desktop\rootAVD-master> .\rootAVD.bat InstallApps

[*] Set Directorys

[-] Test IF ADB SHELL is working

[-] Install all APKs placed in the Apps folder

then a message come saying no apk to install, I did get apk v23 and hand placed it in apps folder then it instaled the app but now is showing the following: C:\Users\lenovo\AppData\Local\Android\Sdk\system-images\android-29\google_apis\x86\ramdisk.img not found
[Android Studio] luluamaral:
Anyone can herp me with the error : C:\Users\lenovo\AppData\Local\Android\Sdk\system-images\android-29\google_apis\x86\ramdisk.img not found??
[Android Studio] newbit:
please look at the frist page to see, how you should ask for help. Also, PS is not working, use cmd instead.
[Android Studio] luluamaral:
thanks for the answer mate, I re-read the readme properly as you advised me, and I understood the steps to install it, and now I'm already running lsposed in it.

Thanks so much for your hard work throughout this project. I'm trying to build a xposed module on android studio, and hoping to be able try to run it now on AVD to test. once again many thanks
[Android Studio] evilol:
Hi, Im using mac with m1 processor and i succeeded to install magisk on my adv, but unfortunately I couldn't succeed to bypass saftynet check. YASNAC says its failed, and I installed safetynet check module in magisk.

I did what I always do when I make my physics devices rooted.

Any help? Thanks ahead.
[Android Studio] newbit:
hi,

AvDs cant bypass safetynet checks. search this thread and/or the github page about it!

If you make it, you would be the first!
[Android Studio] evilol:
hi, thanks for the reply! is there any way to bypass safetynet check with any emulator?
[Android Studio] newbit:
No, not to my knowledge, at least for aosp avds.

You can search the web for it.

They are some pretty good articles about it

and why it can not be passed.

Perhaps you can find something different, if someone made it in the meanwhile.
[Android Studio] Spuqui:
Hey newbit,

First, I wanna thank you for creating these rootAVD scripts. Great work!

Second, I apologize for not following your request of sending all that data when asking a question, and I'll do my best not to ask any question I could answer myself with a little bit of research.

Now, let me try to explain my situation: I currently have an AVD using an API 30 (Android 11) playstore image properly rooted thanks to your script.

What I was hoping for is to be able to root an AVD using a newer API version, 34 if possible but 33, 32 or 31 would be good already.

In the readme.md file you mentioned "Android 14 needs Magisk Version >= 26.x to be rooted", which leads me to believe you already managed to properly root an API 33 AVD.

If we are being technical, I think I've managed to get even the API 34 AVD rooted, since I had root access using "adb shell" and then "su", but that amount of root still does not reach the "proper" level for me, as what I really wanted was for the FX File Explorer to be able to mount the root storage (/) as writable, which is working fine in the API 30 AVD.

So, in the end my problem is not exactly not being able to root, but actually not being able to mount the root storage with read and write permissions, which to my knowledge is a root feature. Any helpful hints?

Kind regards,

Spuqui

Have you tried looking for the "ramdisk.img" file in your folder structure?

If you are using a playstore image, the path would have \google_apis_playstore\ instead of only \google_apis\, and if you are using an image that does not have playstore, it should be already rooted by default, where you can even use the "adb root" command without getting a "adb root is not allowed in production systems" error.
[Android Studio] Spuqui:
Nevermind this question. I have actually decided to go with the shell, so I developed some scripts and I am able to do what I need to do in Android 15 with the shell rooted.

The fact that FX File Explorer is not able to use the root is an app issue, not a root issue, so this question does not belong here anyway. I could post it in the FX's issues board, but I assume they already know their root only works in APIs up to 30, so I'm settle for now.

Again, thanks newbit for this wonderful script (rootAVD).
[Android Studio] newbit:
Hi @Spuqui,

mounting a SAR partition writable is not possible by definition.

That is why Magisk came up with this huge mirror overlay partition system.

Also all the modules are working this way. If you want to mod a system file,

you have to create a similar structure within a module, and this structure gets

overlayed during boot up. As for now, all API Versions are possible to root with the script.

You could also try xplore instead of FX.

NewBit