Last active
June 21, 2018 18:13
-
-
Save dimalyshev/2a4d680f9491da79144adfe764f343dd to your computer and use it in GitHub Desktop.
android env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call %* | |
goto:eof | |
:init | |
echo set env: tools=%1 | |
set JDK=C:\Program Files\Android\Android Studio\jre | |
::C:\Program Files\Java\jdk1.8.0_25 | |
set ASDK=C:\android\sdk | |
set PATH=%PATH%;%JDK%\bin | |
set PATH=%PATH%;%ASDK%\tools\bin;%ASDK%\platform-tools | |
set PATH=%PATH%;%ASDK%\build-tools\%1 | |
::%ASDK%\tools\android %* | |
goto:eof | |
:make | |
call:init %1 | |
pushd "%~3%" | |
echo begin make %3 level:%2 | |
::set SRC=\src | |
::set OBJ=\obj | |
::set BIN=\bin | |
::set RES=\res | |
set API-LEVEL=%2 | |
set CLASSPATH=%ASDK%\platforms\%API-LEVEL%\android.jar;build\obj | |
set AAPT_OPT=package -v -f -S res -M AndroidManifest.xml -I %ASDK%\platforms\%API-LEVEL%\android.jar | |
:: 11.create R.java | |
aapt %AAPT_OPT% -m -J src | |
::pause | |
:: 12.compile code | |
dir /s/b src\*.java > src.files | |
javac -version | |
::pause | |
javac -verbose -source 1.7 -target 1.7 -d build\obj @src.files | |
::%SRC%\my\drafts\wifi\leds\*.java | |
:: 13.create dex | |
::C:\android\sdk\build-tools\23.0.3\dx.bat | |
::pause | |
call dx --dex --verbose --output=build\bin\classes.dex build\obj lib | |
::pause | |
::exit | |
:: 14.create apk | |
aapt %AAPT_OPT% -F "build\bin\.unsigned.apk" build\bin | |
::aapt add "build\bin\.unsigned.apk" build\bin\classes.dex | |
aapt list "build\bin\.unsigned.apk" | |
::pause | |
:: 15.sign | |
::keytool -genkeypair -validity 365 -keystore mykey.keystore -keyalg RSA -keysize 2048 | |
jarsigner -verbose -keystore .k -storepass password -keypass password ^ | |
-signedjar build\bin\.signed.apk build\bin\.unsigned.apk AndroidTestKey | |
::./apksigner sign --ks mykey.keystore $PROJ/bin/hello.apk | |
:: 16.zip | |
zipalign -v -f 4 build\bin\.signed.apk build\bin\test.apk | |
popd | |
goto:eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::copy to device | |
call run\adb push bin\AndroidTest.apk /sdcard | |
:: and install | |
call run\adb -s emulator-5554 install -r -t bin\AndroidTest.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ASDK=T:\sdk | |
set AVD_NAME=test-dev | |
:: 17.start emul | |
%ASDK%\tools\emulator -wipe-data -avd %AVD_NAME% | |
%ASDK%\tools\emulator -wipe-data -datadir T:\android\ @%AVD_NAME% | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
call %~dp0\..\a\build\a.bat :init 23.0.3 | |
::adb /? > adb.hlp | |
::adb -s emulator-5554 install -r -t bin\AndroidTest.apk | |
adb -d install -d -r build\bin\test.apk | |
adb shell am start my.libre/.Main | |
adb shell logcat -t 100 -f .log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set AVD_HOME=T:\avd\test | |
md %AVD_HOME% | |
call a.bat | |
set JAVA_HOME=%JDK% | |
::android create avd -n test-dev -c 128M -d 15 -p %AVD_HOME% -t android-27 -s 240x320 --force | |
call avdmanager create avd -p T:\avd\test -k "system-images;android-27;google_apis;x86" -f -n test | |
::exit | |
set AVD_INI=%AVD_HOME%\config.ini | |
echo disk.dataPartition.size=200M >> %AVD_INI% | |
echo hw.gpu.enabled=yes >> %AVD_INI% | |
echo hw.keyboard=yes >> %AVD_INI% | |
echo skin.dynamic=no >> %AVD_INI% | |
::echo skin.name=240x320 >> %AVD_INI% | |
::echo skin.path=240x320 >> %AVD_INI% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set JDK=C:\Program Files\Java\jdk1.8.0_25 | |
:: 8. create keystore | |
set CERT_NAME="CN=company name,OU=organisational unit,O=organisation,L=location,S=state,C=country code" | |
"%JDK%\bin\keytool" -genkeypair -validity 10000 -dname %CERT_NAME% -keystore %DEV_HOME%\AndroidTest.keystore -storepass password -keypass password -alias AndroidTestKey -keyalg RSA -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cls | |
rd /q/s bin obj | |
md bin obj | |
set DEV_HOME=%1 | |
if .%DEV_HOME%==. set DEV_HOME=. | |
call run\a.bat 27.0.3 | |
set API-LEVEL=android-27 | |
set CLASSPATH=%ASDK%\platforms\%API-LEVEL%\android.jar;%DEV_HOME%\obj | |
set AAPT_OPT=package -v -f -S %DEV_HOME%\res -M %DEV_HOME%\AndroidManifest.xml -I %ASDK%\platforms\%API-LEVEL%\android.jar | |
::echo %PATH% > 111 | |
:: 11.create R.java | |
aapt %AAPT_OPT% -m -J %DEV_HOME%\src | |
:: 12.compile code | |
javac -verbose -d %DEV_HOME%\obj -sourcepath %DEV_HOME%\src %DEV_HOME%\src\my\drafts\wifi\leds\*.java | |
:: 13.create dex | |
::dx --dex --verbose --output=%DEV_HOME%\bin\classes.dex %DEV_HOME%\obj %DEV_HOME%\lib | |
::exit | |
:: 14.create apk | |
aapt %AAPT_OPT% -F %DEV_HOME%\bin\AndroidTest.unsigned.apk %DEV_HOME%\bin | |
:: 15.sign | |
jarsigner -verbose -keystore %DEV_HOME%\AndroidTest.keystore ^ | |
-storepass password -keypass password ^ | |
-signedjar %DEV_HOME%\bin\AndroidTest.signed.apk %DEV_HOME%\bin\AndroidTest.unsigned.apk ^ | |
AndroidTestKey | |
:: 16.zip | |
zipalign -v -f 4 %DEV_HOME%\bin\AndroidTest.signed.apk %DEV_HOME%\bin\AndroidTest.apk | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: | |
:: CREATE ANDROID SDK | |
:: | |
cls | |
@set SDK_PATH=T:\sdk\ | |
@if "%1" neq "" set SDK_PATH=%1 | |
::xcopy *.zip "%SDK_PATH%" | |
::@xcopy /S/Y . "%SDK_PATH%distr\" | |
::cd "%SDK_PATH%distr" | |
@set UZ=unzip -n -qq | |
:: TOOLS | |
%UZ% tools_r25.1.7-windows -d %SDK_PATH% | |
:: PLATFORM-TOOLS | |
%UZ% platform-tools_r24-windows -d %SDK_PATH% | |
:: BUILD-TOOLS | |
%UZ% build-tools\build-tools_r19.1-windows -d %SDK_PATH%\build-tools | |
::%UZ% build-tools\build-tools_r24.0.1-windows -d %SDK_PATH%\build-tools | |
:: SDK PLATFORM | |
%UZ% platforms\android-19_r04 -d %SDK_PATH%\platforms | |
%UZ% platforms\platform-24_r01 -d %SDK_PATH%\platforms | |
:: SYS IMAGES | |
@set SRC=sys-img\android\sysimg_ | |
:: level 19 | |
@set SIMG=%SDK_PATH%system-images\android-19\default | |
md %SIMG% | |
::%UZ% %SRC%armv7a-19_r03 -d "%SIMG%" | |
::%UZ% %SRC%x86-19_r05 -d "%SIMG%" | |
:: level 24 | |
@set SIMG=%SDK_PATH%system-images\android-24\default | |
md %SIMG% | |
::%UZ% %SRC%armeabi-v7a-24_r05 -d "%SIMG%" | |
::%UZ% %SRC%x86-24_r05 -d "%SIMG%" | |
%UZ% %SRC%x86_64-24_r05 -d "%SIMG%" | |
:: DOCS | |
%UZ% docs-23_r01.zip -d %SDK_PATH% | |
cd .. | |
::rd /q/s distr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Files to make Android SDK env
Others: