-
Notifications
You must be signed in to change notification settings - Fork 0
/
installondevice.bat
65 lines (59 loc) · 1.64 KB
/
installondevice.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@REM Build & install on Android phone
@REM Force continuation after Gradle command by capturing the output
if "%~1"=="prod" (
echo building a production build
call gradlew clean assembleProdRelease
if ERRORLEVEL 1 (
echo Gradle build failed! Check build_output.txt for details.
exit /b 1
)
) else (
echo building a development build
call gradlew assembleDevDebug
if ERRORLEVEL 1 (
echo Gradle build failed! Check build_output.txt for details.
exit /b 1
)
)
@REM Start ADB server
adb start-server
if ERRORLEVEL 1 (
echo Failed to start ADB server! Exiting...
exit /b 1
)
@REM Check if a device is connected
adb devices
if ERRORLEVEL 1 (
echo No device found! Make sure your device is connected and USB debugging is enabled.
adb kill-server
exit /b 1
)
@REM Install the APK on the connected device
if "%~1"=="prod" (
echo Installing a production apk
adb install ./app/build/outputs/apk/prod/release/app-prod-universal-release.apk
if ERRORLEVEL 1 (
echo Gradle build failed! Check build_output.txt for details.
exit /b 1
)
) else (
echo Installing a dev apk
adb install ./app/build/outputs/apk/dev/debug/app-dev-universal-debug.apk
if ERRORLEVEL 1 (
echo Gradle build failed! Check build_output.txt for details.
exit /b 1
)
)
if ERRORLEVEL 1 (
echo APK installation failed! Exiting...
adb kill-server
exit /b 1
)
@REM Kill ADB server after installation
adb kill-server
if ERRORLEVEL 1 (
echo Failed to stop ADB server! Exiting...
exit /b 1
)
echo Build and installation completed successfully!
exit /b 0