I use the following .bat script to install my game on my device (meta quest 3), including apk, obb and bundles.
It works most of the time but when it gives an error I would like an error message to be shown so I know to try again.
Unfortunately I am extremely bad at these things.
The code:
call:stampaLogo
@echo.
setlocal
set "ANDROIDHOME=%cd%"
set ADB="%ANDROIDHOME%platform-toolsadb.exe"
set DEVICE=
if not "%1"=="" set DEVICE=-s %1
set STORAGE=/sdcard
@echo.
call:printLogo
@echo Removing previous version of Meta Escape if present.
%ADB% %DEVICE% uninstall com.MetaExperience.MetaEscape
@echo.
call:printLogo
%ADB% %DEVICE% install MetaEscape.apk
call:printLogo
%ADB% %DEVICE% push MetaEscape.main.obb /sdcard/Android/obb/com.MetaExperience.MetaEscape/main.3.com.MetaExperience.MetaEscape.obb
call:printLogo
for /R "bundles" %%F in ("*.bundle") do (
%ADB% %DEVICE% push %%F /sdcard/Android/obb/com.MetaExperience.MetaEscape/%%~nF.bundle
call:printLogo
)
call:printLogo
%ADB% %DEVICE% push MetaEscape.main.obb /sdcard/Android/obb/com.MetaExperience.MetaEscape/main.3.com.MetaExperience.MetaEscape.obb
@if "%ERRORLEVEL%" NEQ "0" goto Error
@echo.
%ADB% %DEVICE% shell pm grant com.MetaExperience.MetaEscape android.permission.READ_EXTERNAL_STORAGE
%ADB% %DEVICE% shell pm grant com.MetaExperience.MetaEscape android.permission.WRITE_EXTERNAL_STORAGE
%ADB% %DEVICE% shell pm grant com.MetaExperience.MetaEscape android.permission.RECORD_AUDIO
@echo off
cls
@echo " __ __________________ ___________ _________ ____ ______
@echo " / |/ / ____/_ __/ | / ____/ ___// ____/ | / __ / ____/
@echo " / /|_/ / __/ / / / /| | / __/ __ / / / /| | / /_/ / __/
@echo " / / / / /___ / / / ___ | / /___ ___/ / /___/ ___ |/ ____/ /___
@echo " /_/ _/_/_____/_/_/_/_/__|_|_ /_____//____/____/_/__|_/_/ /_____/
@echo " / _/ | / / ___/_ __/ | / / / / / ____/ __
@echo " / // |/ /__ / / / /| | / / / / / __/ / / / /
@echo " _/ // /| /___/ // / / ___ |/ /___/ /___/ /___/ /_/ /
@echo " /___/_/ |_//____//_/_/_/ _|_/_____/_____/_____/_____/_________________
@echo " | | / / _/_ __/ / / / / ___// / / / ____/ ____/ ____/ ___/ ___/
@echo " | | /| / // / / / / /_/ / __ / / / / / / / / __/ __ \__
@echo " | |/ |/ // / / / / __ / ___/ / /_/ / /___/ /___/ /___ ___/ /__/ /
@echo " |__/|__/___/ /_/ /_/ /_/ /____/____/____/____/_____//____/____/
@echo "
@echo Press enter to exit...
set /p input=
goto:eof
:Error
call:stampaErrore
@echo.
@echo There was an error installing Meta Escape on this device.
@echo.
@echo Possible solutions::
@echo -Make sure your device is connected.
@echo -Make sure you have development settings enabled from the Meta Quest phone app.
@echo -Close all programs on your computer.
@echo -If the error persists, contact us at: [email protected]
@pause
:printLogo
cls
@echo " __ __________________ ___________ _________ ____ ______
@echo " / |/ / ____/_ __/ | / ____/ ___// ____/ | / __ / ____/
@echo " / /|_/ / __/ / / / /| | / __/ __ / / / /| | / /_/ / __/
@echo " / / / / /___ / / / ___ | / /___ ___/ / /___/ ___ |/ ____/ /___
@echo " /_/ /_/_____/ /_/ /_/ |_| /_____//____/____/_/ |_/_/ /_____/
@echo " ___ _ __ ____ _____ __ __ __ ______ ___
@echo " / _/ | / / ___/_ __/ | / / / / / ____/ __
@echo " / // |/ /__ / / / /| | / / / / / __/ / /_/ /
@echo " _/ // /| /___/ // / / ___ |/ /___/ /___/ /___/ _, _/
@echo " /___/_/ |_//____//_/ /_/ |_/_____/_____/_____/_/ |_|
exit /B
:stampaErrore
@echo " __________ ____ ____ ____ __
@echo " / ____/ __ / __ / __ / __ / /
@echo " / __/ / /_/ / /_/ / / / / /_/ / /
@echo " / /___/ _, _/ _, _/ /_/ / _, _/_/
@echo " /_____/_/ |_/_/ |_|____/_/ |_(_)
exit /B
As you can see from the code, the previous version is uninstalled, the apk, the obb and all the bundles in the “Bundles” folder with the “.bundle” extension are installed.
I install the obb file twice because with ADB the first copy often fails.
Thanks to anyone who can help me