-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenerate APK of a custom React Native Project.bat
30 lines (26 loc) · 1.26 KB
/
Generate APK of a custom React Native Project.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
@echo off
:: echo %ERRORLEVEL%
for /D %%p in ("android\app\src\main\res\drawable-*") do (
rmdir "%%p" /Q /S
)
:: SOURCE1: https://superuser.com/questions/691072/delete-several-directories-with-a-common-prefix-at-the-command-prompt
:: SOURCE2: https://stackoverflow.com/questions/2591758/batch-script-loop
cd android
call gradlew clean
:: echo %ERRORLEVEL%
:: 'call' proceeds with next command, if the current one fails with any error.
cd ..
:: TO RESOLVE: Release APK Not Updating With JavaScript Code:
:: SOURCE: https://stackoverflow.com/questions/45441217/release-apk-not-updating-with-javascript-code
:: del android\app\src\main\assets\index.android.*
:: start cmd /c react-native bundle --platform android --dev false --entry-file index.js --bundle-output android\app\src\main\assets\index.android.bundle --assets-dest android\app\src\main\res
cd android
:: SOURCE: https://stackoverflow.com/questions/1164049/batch-files-error-handling
call gradlew assembleRelease
cd ..
echo generated apk in:
echo android/app/build/outputs/apk/debug/
echo OR
cmd /k echo android/app/build/outputs/apk/release/app-release.apk
:: TODO: https://stackoverflow.com/questions/2048509/how-to-echo-with-different-colors-in-the-windows-command-line
:: cmd /k echo "Error in gradlew assembleRelease!"