::build all for toolAlite by kuyagaol
@echo off
color %warnabaru%
echo. ^>^> %~n1.apk
echo.
echo. ...Checking and removing previous build folder
if exist "..\projects\%~n1.apk\build" rmdir /S /Q "..\projects\%~n1.apk\build"
echo.
echo. ...Checking and removing previous output apk
if exist "..\output_apk\Signed%~n1.apk" del /Q "..\output_apk\Signed%~n1.apk"
if exist "..\output_apk\Unsigned%~n1.apk" del /Q "..\output_apk\Unsigned%~n1.apk"
if exist "..\output_apk\%~n1.apk" del /Q "..\output_apk\%~n1.apk"
echo.
echo. ...Building %~n1.apk
java -Xmx%heapy%m -jar apktool.jar b "..\projects\%~n1%~x1" "..\output_apk\Unsigned%~n1%~x1"
if errorlevel 1 goto errorcompall
:: check input apk exist or not
if exist "..\input_apk\%~n1.apk" goto cpsignature
echo.
echo. Done.
echo.
echo  ===============================================================================
echo. Unsigned%~n1%~x1 (no signature) created in in output_apk folder
echo.
::pause
echo.
goto quit
:cpsignature
::only META-INF copied from original apk
7za x -o"..\projects\temp" "..\input_apk\%~n1%~x1" META-INF -r
7za a -tzip "..\output_apk\Unsigned%~n1%~x1" "..\projects\temp\*" -mx%usrc% -r
rmdir /S /Q "..\projects\temp"
ren "..\output_apk\Unsigned%~n1%~x1" "%~n1%~x1"
echo.
echo. Done.
echo.
echo  ===============================================================================
echo. %~n1%~x1 created in output_apk folder
echo.
::pause
echo.
goto quit
:errorcompall
echo.
echo  ===============================================================================
echo. An Error Occured, Please Check The Log (Option # 96)
echo.
set /A error+=1
::pause
echo.
:quit