Fix x86_64 Android AVD in Windows (#2471)

This commit is contained in:
Ajin Abraham
2024-12-02 21:43:53 -08:00
parent b75d209063
commit 0d3b1ec3b9
2 changed files with 38 additions and 4 deletions
+34 -2
View File
@@ -51,5 +51,37 @@ if (-not $AVD_FOUND) {
}
# Start the emulator with user-defined AVD and port
Start-Process -FilePath $EMULATOR_PATH -ArgumentList "-avd $AVD_NAME -writable-system -no-snapshot -wipe-data -port $START_PORT"
Write-Output "Emulator started with AVD $AVD_NAME on port $START_PORT."
Start-Process -NoNewWindow -FilePath $EMULATOR_PATH -ArgumentList "-avd $AVD_NAME -writable-system -no-snapshot -wipe-data -port $START_PORT"
Write-Output "Starting AVD $AVD_NAME on port $START_PORT."
# Wait for the emulator to boot completely
Write-Output "Waiting for emulator to boot..."
& $ADB_PATH wait-for-device
Start-Sleep -Seconds 5
Write-Output "Emulator booted successfully."
# Allow /system remount
Write-Output "Restarting adb as root..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "root"
Write-Output "Disabling AVB verification..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "shell avbctl disable-verification"
Write-Output "Disabling verity..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "disable-verity"
Write-Output "Restarting emulator..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "reboot"
Write-Output "Waiting for emulator to reboot..."
& $ADB_PATH wait-for-device
Start-Sleep -Seconds 5
Write-Output "Emulator rebooted successfully."
Write-Output "Restarting adb as root..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "root"
Write-Output "Remounting the filesystem..."
Start-Process -NoNewWindow -Wait -FilePath $ADB_PATH -ArgumentList "remount"
Write-Output "Emulator ready for Dynamic Analysis with MobSF."
+4 -2
View File
@@ -66,7 +66,9 @@ done
# Start the emulator with user-defined AVD and port
"$EMULATOR_PATH" -avd "$AVD_NAME" -writable-system -no-snapshot -wipe-data -port "$START_PORT" >/dev/null 2>&1 &
echo "$(tput setaf 2)Emulator AVD $AVD_NAME started on port $START_PORT$(tput sgr0)"
echo "$(tput setaf 2)Starting AVD $AVD_NAME on port $START_PORT$(tput sgr0)"
echo "Waiting for emulator to boot..."
"$ADB_PATH" wait-for-device
# Check if socat is available only on Linux
if [ "$(uname)" = "Linux" ]; then
@@ -124,7 +126,7 @@ if [ -n "$GAPPS_ZIP" ]; then
tar -x --strip-components 2 -f $f -C $PLAY_EXTRACT_DIR || { echo "$(tput setaf 1)Error: Extraction failed$(tput sgr0)"; exit 1; }
done
echo "Waiting for emulator to complete booting..."
echo "Waiting for the emulator to be ready..."
sleep 25
echo "Installing PlayStore components"
"$ADB_PATH" root