script.bat


SUBMITTED BY: jrmart1709

DATE: Nov. 9, 2015, 12:57 a.m.

FORMAT: Text only

SIZE: 19.0 kB

HITS: 4546

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. COLOR 0A
  4. if (%1)==(0) goto skipme
  5. if (%1) neq () goto adbi
  6. echo -------------------------------------------------------------------------- >> log.txt
  7. echo ^|%date% -- %time%^| >> log.txt
  8. echo -------------------------------------------------------------------------- >> log.txt
  9. Script 0 2>> log.txt
  10. :skipme
  11. mode con:cols=81 lines=40
  12. :skipme
  13. set usrc=9
  14. set capp=None
  15. set heapy=64
  16. java -version
  17. if errorlevel 1 goto errjava
  18. adb version
  19. if errorlevel 1 goto erradb
  20. set /A count=0
  21. FOR %%F IN (place-apk-here-for-modding/*.apk) DO (
  22. set /A count+=1
  23. set tmpstore=%%~nF%%~xF
  24. )
  25. if %count%==1 (set capp=%tmpstore%)
  26. cls
  27. :restart
  28. cd "%~dp0"
  29. set menunr=GARBAGE
  30. cls
  31. echo ------------------------------------------------------------------------------
  32. echo ^| Compression-Level: %usrc% ^| Heap Size: %heapy%mb ^| Current-App: %capp% ^|
  33. echo ------------------------------------------------------------------------------
  34. echo ----------------------------------
  35. echo Simple Tasks Such As Image Editing
  36. echo ----------------------------------
  37. echo 0 Adb pull
  38. echo 1 Extract apk
  39. echo 2 Optimize images inside
  40. echo 3 Zip apk
  41. echo 4 Sign apk (Dont do this if its a system apk)
  42. echo 5 Zipalign apk (Do once apk is created/signed)
  43. echo 6 Install apk (Dont do this if system apk, do adb push)
  44. echo 7 Zip / Sign / Install apk (All in one step)
  45. echo 8 Adb push (Only for system apk)
  46. echo -----------------------------------
  47. echo Advanced Tasks Such As Code Editing
  48. echo -----------------------------------
  49. echo 9 Decompile apk
  50. echo 10 Decompile apk (with dependencies) (For propietary rom apks)
  51. echo 11 Compile apk
  52. echo 12 Sign apk
  53. echo 13 Install apk
  54. echo 14 Compile apk / Sign apk / Install apk (Non System Apps Only)
  55. echo -----------
  56. echo Other Stuff
  57. echo -----------
  58. echo 15 Batch Optimize Apk (inside place-apk-here-to-batch-optimize only)
  59. echo 16 Sign an apk(Batch support)(inside place-apk-here-for-signing folder only)
  60. echo 17 Batch optimize ogg files (inside place-ogg-here only)
  61. echo 18 Clean Files/Folders
  62. echo 19 Select compression level for apk's
  63. echo 20 Set Max Memory Size (Only use if getting stuck at decompiling/compiling)
  64. echo 21 Read Log
  65. echo 22 Set current project
  66. echo 23 About / Tips / Debug Section
  67. echo 24 Quit
  68. echo -------------------------------------------------------------------------------
  69. SET /P menunr=Please make your decision:
  70. IF %menunr%==0 (goto ap)
  71. IF %menunr%==15 (goto bopt)
  72. IF %menunr%==16 (goto asi)
  73. IF %menunr%==17 (goto ogg)
  74. IF %menunr%==19 (goto usrcomp)
  75. IF %menunr%==20 (goto heap)
  76. IF %menunr%==21 (goto logr)
  77. IF %menunr%==22 (goto filesel)
  78. IF %menunr%==23 (goto about)
  79. IF %menunr%==24 (goto quit)
  80. IF %menunr%==18 (goto cleanp)
  81. if %capp%==None goto noproj
  82. IF %menunr%==1 (goto ex)
  83. IF %menunr%==2 (goto opt)
  84. IF %menunr%==3 (goto zip)
  85. IF %menunr%==4 (goto si)
  86. IF %menunr%==5 (goto zipa)
  87. IF %menunr%==6 (goto ins)
  88. IF %menunr%==7 (goto alli)
  89. IF %menunr%==8 (goto apu)
  90. IF %menunr%==9 (goto de)
  91. IF %menunr%==10 (goto ded)
  92. IF %menunr%==11 (goto co)
  93. IF %menunr%==12 (goto si)
  94. IF %menunr%==13 (goto ins)
  95. IF %menunr%==14 (goto all)
  96. :WHAT
  97. echo You went crazy and entered something that wasnt part of the menu options
  98. PAUSE
  99. goto restart
  100. :cleanp
  101. echo 1. Clean This Project's Folder
  102. echo 2. Clean All Apk's in Modding Folder
  103. echo 3. Clean All OGG's in OGG Folder
  104. echo 4. Clean All Apk's in Optimize Folder
  105. echo 5. Clean All Apk's in Signing Folder
  106. echo 6. Clean All Projects
  107. echo 7. Clean All Folders/Files
  108. echo 8. Go Back To Main Menu
  109. SET /P menuna=Please make your decision:
  110. echo Clearing Directories
  111. IF %menuna%==1 (
  112. if %capp%==None goto noproj
  113. rmdir /S /Q %userprofile%\apktool > nul
  114. rmdir /S /Q projects\%capp% > nul
  115. mkdir projects\%capp%
  116. )
  117. IF %menuna%==2 (
  118. rmdir /S /Q %userprofile%\apktool > nul
  119. rmdir /S /Q place-apk-here-for-modding > nul
  120. mkdir place-apk-here-for-modding
  121. )
  122. IF %menuna%==3 (
  123. rmdir /S /Q place-ogg-here > nul
  124. mkdir place-ogg-here
  125. )
  126. IF %menuna%==4 (
  127. rmdir /S /Q place-apk-here-to-batch-optimize > nul
  128. mkdir place-apk-here-to-batch-optimize
  129. )
  130. IF %menuna%==5 (
  131. rmdir /S /Q place-apk-here-for-signing > nul
  132. mkdir place-apk-here-for-signing
  133. )
  134. IF %menuna%==7 (
  135. rmdir /S /Q %userprofile%\apktool > nul
  136. rmdir /S /Q projects\%capp% > nul
  137. mkdir projects\%capp%
  138. rmdir /S /Q place-apk-here-for-modding > nul
  139. mkdir place-apk-here-for-modding
  140. rmdir /S /Q place-ogg-here > nul
  141. mkdir place-ogg-here
  142. rmdir /S /Q place-apk-here-to-batch-optimize > nul
  143. mkdir place-apk-here-to-batch-optimize
  144. rmdir /S /Q place-apk-here-for-signing > nul
  145. mkdir place-apk-here-for-signing
  146. rmdir /S /Q %userprofile%\apktool > nul
  147. rmdir /S /Q projects > nul
  148. mkdir projects
  149. )
  150. IF %menuna%==6 (
  151. rmdir /S /Q %userprofile%\apktool > nul
  152. rmdir /S /Q projects > nul
  153. mkdir projects
  154. )
  155. goto restart
  156. :about
  157. cls
  158. echo About
  159. echo -----
  160. echo Apk Manager v4.9
  161. echo ApkTool v1.3.2
  162. echo 7za v4.6.5
  163. echo Roptipng v0.6.3
  164. echo Sox v14.3.1
  165. echo Android Asset Packaging Tool v0.2
  166. echo.
  167. echo Tips
  168. echo ----
  169. echo 1. If Modifying system apps, never resign them unless you want to resign all
  170. echo apk's that share its shared:uid
  171. echo 2. If decompiling/recompiling system apps and if AndroidManifest.xml was not
  172. echo preserved from the original apk, then either push the apk when in recovery or
  173. echo by doing :
  174. echo adb remount
  175. echo adb shell stop
  176. echo adb push something.apk /wherever/something.apk
  177. echo adb shell start
  178. echo 3. Decompiling a themed apk is not possible, you must get the original unthemed
  179. echo apk, then decompile, make your theme/xml changes and recompile
  180. echo 4. If you're stuck and the log doesnot give you any indication as to what you
  181. echo are doing wrong, then post in the thread http://www.tiny.cc/apkmanager
  182. echo Make sure u include ur log.txt, and if its not a editing problem i.e
  183. echo its something regarding when u push it to your phone, then post ur adb log
  184. echo as well. To do so
  185. echo follow these steps :
  186. echo 1. Connect ur phone to ur pc
  187. echo 2. Push/install the app on your phone
  188. echo 3. Select "Create Log" option on this menu
  189. echo 4. Let the new window run for 10 seconds, then close it
  190. echo Once done, you will find a adblog.txt in the root folder
  191. echo Upload that as well.
  192. echo.
  193. echo 1. Create log
  194. echo 2. Go back to main menu
  195. SET /P menunr=Please make your decision:
  196. IF %menunr%==1 (Start "Adb Log" other\signer 2)
  197. goto restart
  198. :portapk
  199. echo Im going to try resigning the apk and see if that works
  200. echo Did it successfully install (y/n) ^?
  201. echo Ok, lets try looking through for any shared uid, if i find any i will remove them
  202. :filesel
  203. cls
  204. set /A count=0
  205. FOR %%F IN (place-apk-here-for-modding/*.apk) DO (
  206. set /A count+=1
  207. set a!count!=%%F
  208. if /I !count! LEQ 9 (echo ^- !count! - %%F )
  209. if /I !count! GTR 10 (echo ^- !count! - %%F )
  210. )
  211. echo.
  212. echo Choose the app to be set as current project?
  213. set /P INPUT=Enter It's Number: %=%
  214. if /I %INPUT% GTR !count! (goto chc)
  215. if /I %INPUT% LSS 1 (goto chc)
  216. set capp=!a%INPUT%!
  217. goto restart
  218. :chc
  219. set capp=None
  220. goto restart
  221. rem :bins
  222. rem echo Waiting for device
  223. rem adb wait-for-device
  224. rem echo Installing Apks
  225. rem FOR %%F IN ("%~dp0place-apk-here-for-signing\*.apk") DO adb install -r "%%F"
  226. rem goto restart
  227. :heap
  228. set /P INPUT=Enter max size for java heap space in megabytes (eg 512) : %=%
  229. set heapy=%INPUT%
  230. cls
  231. goto restart
  232. :usrcomp
  233. set /P INPUT=Enter Compression Level (0-9) : %=%
  234. set usrc=%INPUT%
  235. cls
  236. goto restart
  237. :ogg
  238. cd other
  239. mkdir temp
  240. echo Optimizing Ogg
  241. FOR %%F IN ("../place-ogg-here/*.ogg") DO sox "../place-ogg-here/%%F" -C 0 "temp\%%F"
  242. cd ..
  243. MOVE other\temp\* place-ogg-here
  244. rmdir /S /Q other\temp
  245. goto restart
  246. :alli
  247. IF NOT EXIST "%~dp0projects\%capp%" GOTO dirnada
  248. cls
  249. echo 1 System apk (Retains signature)
  250. echo 2 Regular apk (Removes signature for re-signing)
  251. SET /P menunr=Please make your decision:
  252. IF %menunr%==1 (goto sys1)
  253. IF %menunr%==2 (goto oa1)
  254. :sys1
  255. echo Zipping Apk
  256. cd other
  257. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../projects/%capp%/*" -mx%usrc%
  258. if errorlevel 1 (
  259. echo "An Error Occured, Please Check The Log (option 21)"
  260. PAUSE
  261. )
  262. cd ..
  263. goto si1
  264. :oa1
  265. cd other
  266. echo Zipping Apk
  267. rmdir /S /Q "../out/META-INF"
  268. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../projects/%capp%/*" -mx%usrc%
  269. if errorlevel 1 (
  270. echo "An Error Occured, Please Check The Log (option 21)"
  271. PAUSE
  272. )
  273. cd ..
  274. :si1
  275. cd other
  276. echo Signing Apk
  277. java -Xmx%heapy%m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ../place-apk-here-for-modding/unsigned%capp% ../place-apk-here-for-modding/signed%capp%
  278. if errorlevel 1 (
  279. echo "An Error Occured, Please Check The Log (option 21)"
  280. PAUSE
  281. )
  282. DEL /Q "../place-apk-here-for-modding/unsigned%capp%"
  283. cd ..
  284. :ins1
  285. echo Waiting for device
  286. adb wait-for-device
  287. echo Installing Apk
  288. adb install -r place-apk-here-for-modding/signed%capp%
  289. if errorlevel 1 (
  290. echo "An Error Occured, Please Check The Log (option 21)"
  291. PAUSE
  292. )
  293. goto restart
  294. :asi
  295. cd other
  296. DEL /Q "../place-apk-here-for-signing/signed.apk"
  297. FOR %%F in (../place-apk-here-for-signing/*) DO call signer "%%F"
  298. cd ..
  299. goto restart
  300. :bopt
  301. set /P INPUT=Do you want to zipalign(z), optimize png(p) or both(zp)? : %=%
  302. FOR %%F IN (place-apk-here-to-batch-optimize\*.apk) DO (call :dan "%%F")
  303. MOVE "other\optimized\*.apk" "place-apk-here-to-batch-optimize"
  304. rmdir /S /Q "other\optimized"
  305. goto restart
  306. :dan
  307. if (%INPUT%)==(zp) GOTO zipb
  308. if (%INPUT%)==(z) GOTO zipo
  309. :zipb
  310. @echo Optimizing %~1...
  311. cd other
  312. md "apkopt_temp_%~n1"
  313. md optimized
  314. dir /b
  315. 7za x -o"apkopt_temp_%~n1" "../place-apk-here-to-batch-optimize/%~n1%~x1"
  316. mkdir temp
  317. xcopy "apkopt_temp_%~n1\res\*.9.png" "temp" /S /Y
  318. roptipng -o99 "apkopt_temp_%~n1\**\*.png"
  319. del /q "..\place-apk-here-to-batch-optimize\%~n1%~x1"
  320. xcopy "temp" "apkopt_temp_%~n1\res" /S /Y
  321. rmdir "temp" /S /Q
  322. if (%INPUT%)==(p) GOTO ponly
  323. 7za a -tzip "optimized\%~n1.unaligned.apk" "%~dp0other\apkopt_temp_%~n1\*" -mx%usrc%
  324. rd /s /q "apkopt_temp_%~n1"
  325. zipalign -v 4 "optimized\%~n1.unaligned.apk" "optimized\%~n1.apk"
  326. del /q "optimized\%~n1.unaligned.apk"
  327. goto endab
  328. :ponly
  329. 7za a -tzip "optimized\%~n1.apk" "%~dp0other\apkopt_temp_%~n1\*" -mx%usrc%
  330. rd /s /q "apkopt_temp_%~n1"
  331. goto endab
  332. :zipo
  333. @echo Optimizing %~1...
  334. zipalign -v 4 "%~dp0place-apk-here-to-batch-optimize\%~n1%~x1" "%~dp0place-apk-here-to-batch-optimize\u%~n1%~x1"
  335. del /q "%~dp0place-apk-here-to-batch-optimize\%~n1%~x1"
  336. rename "%~dp0place-apk-here-to-batch-optimize\u%~n1%~x1" "%~n1%~x1"
  337. goto endab
  338. :dirnada
  339. echo %capp% has not been extracted, please do so before doing this step
  340. PAUSE
  341. goto restart
  342. :opt
  343. IF NOT EXIST "%~dp0projects\%capp%" GOTO dirnada
  344. mkdir temp
  345. xcopy "%~dp0projects\%capp%\res\*.9.png" "%~dp0temp" /S /Y
  346. cd other
  347. echo Optimizing Png's
  348. roptipng -o99 "../projects/%capp%/**/*.png"
  349. cd ..
  350. xcopy "%~dp0temp" "%~dp0projects\%capp%\res" /S /Y
  351. rmdir temp /S /Q
  352. goto restart
  353. :noproj
  354. echo Please Select A Project To Work On (Option #22)
  355. PAUSE
  356. goto restart
  357. :ap
  358. echo Where do you want adb to pull the apk from?
  359. echo Example of input : /system/app/launcher.apk
  360. set /P INPUT=Type input: %=%
  361. echo Pulling apk
  362. adb pull %INPUT% "%~dp0place-apk-here-for-modding\something.apk"
  363. if errorlevel 1 (
  364. echo "An Error Occured, Please Check The Log (option 21)"
  365. PAUSE
  366. goto restart
  367. )
  368. :renameagain
  369. echo What filename would you like this app to be stored as ?
  370. echo Eg (launcher.apk)
  371. set /P INPUT=Type input: %=%
  372. IF EXIST "%~dp0place-apk-here-for-modding\%INPUT%" (
  373. echo File Already Exists, Try Another Name
  374. PAUSE
  375. goto renameagain)
  376. rename "%~dp0place-apk-here-for-modding\something.apk" %INPUT%
  377. echo Would you like to set this as your current project (y/n)?
  378. set /P inab=Type input: %=%
  379. if %inab%==y (set capp=%INPUT%)
  380. goto restart
  381. :apu
  382. echo Where do you want adb to push to and as what name
  383. echo Example of input : /system/app/launcher.apk
  384. set /P INPUT=Type input: %=%
  385. echo Waiting for device
  386. adb wait-for-device
  387. adb remount
  388. echo Pushing apk
  389. adb push "place-apk-here-for-modding\unsigned%capp%" %INPUT%
  390. if errorlevel 1 (
  391. echo "An Error Occured, Please Check The Log (option 21)"
  392. PAUSE
  393. )
  394. goto restart
  395. :zipa
  396. echo Zipaligning Apk
  397. IF EXIST "%~dp0place-apk-here-for-modding\signed%capp%" zipalign -f 4 "%~dp0place-apk-here-for-modding\signed%capp%" "%~dp0place-apk-here-for-modding\signedaligned%capp%"
  398. IF EXIST "%~dp0place-apk-here-for-modding\unsigned%capp%" zipalign -f 4 "%~dp0place-apk-here-for-modding\unsigned%capp%" "%~dp0place-apk-here-for-modding\unsignedaligned%capp%"
  399. if errorlevel 1 (
  400. echo "An Error Occured, Please Check The Log (option 21)"
  401. PAUSE
  402. )
  403. DEL /Q "%~dp0place-apk-here-for-modding\signed%capp%"
  404. DEL /Q "%~dp0place-apk-here-for-modding\unsigned%capp%"
  405. rename "%~dp0place-apk-here-for-modding\signedaligned%capp%" signed%capp%
  406. rename "%~dp0place-apk-here-for-modding\unsignedaligned%capp%" unsigned%capp%
  407. goto restart
  408. :ex
  409. cd other
  410. echo Extracting apk
  411. IF EXIST "../projects/%capp%" (rmdir /S /Q "../projects/%capp%")
  412. 7za x -o"../projects/%capp%" "../place-apk-here-for-modding/%capp%"
  413. if errorlevel 1 (
  414. echo "An Error Occured, Please Check The Log (option 21)"
  415. PAUSE
  416. )
  417. cd ..
  418. goto restart
  419. :zip
  420. IF NOT EXIST "%~dp0projects\%capp%" GOTO dirnada
  421. cls
  422. echo 1 System apk (Retains signature)
  423. echo 2 Regular apk (Removes signature for re-signing)
  424. SET /P menunr=Please make your decision:
  425. IF %menunr%==1 (goto sys)
  426. IF %menunr%==2 (goto oa)
  427. :sys
  428. echo Zipping Apk
  429. cd other
  430. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../projects/%capp%/*" -mx%usrc%
  431. if errorlevel 1 (
  432. echo "An Error Occured, Please Check The Log (option 21)"
  433. PAUSE
  434. )
  435. cd ..
  436. goto restart
  437. :oa
  438. cd other
  439. echo Zipping Apk
  440. rmdir /S /Q "../out/META-INF"
  441. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../projects/%capp%/*" -mx%usrc%
  442. if errorlevel 1 (
  443. echo "An Error Occured, Please Check The Log (option 21)"
  444. PAUSE
  445. )
  446. cd ..
  447. goto restart
  448. :ded
  449. cd other
  450. IF EXIST "%~dp0place-apk-here-for-modding\unsigned%capp%" (del /Q "%~dp0place-apk-here-for-modding\unsigned%capp%")
  451. :temr
  452. echo Drag the dependee apk in this window or type its path
  453. echo Example to decompile Rosie.apk, drag com.htc.resources.apk in this window
  454. set /P INPUT=Type input: %=%
  455. java -jar apktool.jar if %INPUT%
  456. if NOT EXIST %userprofile%\apktool\framework\2.apk (
  457. echo.
  458. echo "Sorry thats not the dependee apk, try again"
  459. goto temr
  460. )
  461. echo Decompiling Apk
  462. java -Xmx%heapy%m -jar apktool.jar d ../place-apk-here-for-modding/%capp% ../projects/%capp%
  463. if errorlevel 1 (
  464. echo "An Error Occured, Please Check The Log (option 21)"
  465. PAUSE
  466. )
  467. cd ..
  468. goto restart
  469. :de
  470. cd other
  471. DEL /Q "../place-apk-here-for-modding/signed%capp%"
  472. DEL /Q "../place-apk-here-for-modding/unsigned%capp%"
  473. IF EXIST "../projects/%capp%" (rmdir /S /Q "../projects/%capp%")
  474. echo Decompiling Apk
  475. java -Xmx%heapy%m -jar apktool.jar d "../place-apk-here-for-modding/%capp%" "../projects/%capp%"
  476. if errorlevel 1 (
  477. echo "An Error Occured, Please Check The Log (option 21)"
  478. PAUSE
  479. )
  480. cd ..
  481. goto restart
  482. :co
  483. IF NOT EXIST "%~dp0projects\%capp%" GOTO dirnada
  484. cd other
  485. echo Building Apk
  486. IF EXIST "%~dp0place-apk-here-for-modding\unsigned%capp%" (del /Q "%~dp0place-apk-here-for-modding\unsigned%capp%")
  487. java -Xmx%heapy%m -jar apktool.jar b "../projects/%capp%" "%~dp0place-apk-here-for-modding\unsigned%capp%"
  488. if errorlevel 1 (
  489. echo "An Error Occured, Please Check The Log (option 21)"
  490. PAUSE
  491. )
  492. echo Is this a system apk ^(y/n^)
  493. set /P INPU=Type input: %=%
  494. if %INPU%==n (goto q1)
  495. :nq1
  496. echo Aside from the signatures, would you like to copy
  497. echo over any additional files that you didn't modify
  498. echo from the original apk in order to ensure least
  499. echo # of errors ^(y/n^)
  500. set /P INPUT1=Type input: %=%
  501. if %INPUT1%==y (call :nq2)
  502. if %INPUT1%==n (call :nq3)
  503. :nq2
  504. rmdir /S /Q "%~dp0keep"
  505. 7za x -o"../keep" "../place-apk-here-for-modding/%capp%"
  506. echo In the apk manager folder u'll find
  507. echo a keep folder. Within it, delete
  508. echo everything you have modified and leave
  509. echo files that you haven't. If you have modified
  510. echo any xml, then delete resources.arsc from that
  511. echo folder as well. Once done then press enter
  512. echo on this script.
  513. PAUSE
  514. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../keep/*" -mx%usrc% -r
  515. rmdir /S /Q "%~dp0keep"
  516. cd ..
  517. goto restart
  518. :nq3
  519. 7za x -o"../projects/temp" "../place-apk-here-for-modding/%capp%" META-INF -r
  520. 7za a -tzip "../place-apk-here-for-modding/unsigned%capp%" "../projects/temp/*" -mx%usrc% -r
  521. rmdir /S /Q "%~dp0projects/temp"
  522. :q1
  523. cd ..
  524. goto restart
  525. :si
  526. cd other
  527. echo Signing Apk
  528. java -Xmx%heapy%m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ../place-apk-here-for-modding/unsigned%capp% ../place-apk-here-for-modding/signed%capp%
  529. if errorlevel 1 (
  530. echo "An Error Occured, Please Check The Log (option 21)"
  531. PAUSE
  532. )
  533. DEL /Q "../place-apk-here-for-modding/unsigned%capp%"
  534. cd ..
  535. goto restart
  536. :ins
  537. echo Waiting for device
  538. adb wait-for-device
  539. echo Installing Apk
  540. adb install -r place-apk-here-for-modding/signed%capp%
  541. if errorlevel 1 (
  542. echo "An Error Occured, Please Check The Log (option 21)"
  543. PAUSE
  544. )
  545. goto restart
  546. :all
  547. IF NOT EXIST "%~dp0projects\%capp%" GOTO dirnada
  548. cd other
  549. echo Building Apk
  550. IF EXIST "%~dp0place-apk-here-for-modding\unsigned%capp%" (del /Q "%~dp0place-apk-here-for-modding\unsigned%capp%")
  551. java -Xmx%heapy%m -jar apktool.jar b "../projects/%capp%" "%~dp0place-apk-here-for-modding\unsigned%capp%"
  552. if errorlevel 1 (
  553. echo "An Error Occured, Please Check The Log (option 21)"
  554. PAUSE
  555. goto restart
  556. )
  557. echo Signing Apk
  558. java -Xmx%heapy%m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ../place-apk-here-for-modding/unsigned%capp% ../place-apk-here-for-modding/signed%capp%
  559. if errorlevel 1 (
  560. echo "An Error Occured, Please Check The Log (option 21)"
  561. PAUSE
  562. )
  563. DEL /Q "../place-apk-here-for-modding/unsigned%capp%"
  564. cd ..
  565. echo Waiting for device
  566. adb wait-for-device
  567. echo Installing Apk
  568. adb install -r place-apk-here-for-modding/signed%capp%
  569. if errorlevel 1 (
  570. echo "An Error Occured, Please Check The Log (option 21)"
  571. PAUSE
  572. )
  573. goto restart
  574. :errjava
  575. cls
  576. echo Java was not found, you will not be able to sign apks or use apktool
  577. PAUSE
  578. goto restart
  579. :erradb
  580. cls
  581. echo Adb was not found, you will not be able to manipulate the files on your phone
  582. PAUSE
  583. goto restart
  584. :adbi
  585. mode con:cols=48 lines=8
  586. echo Waiting for device
  587. adb wait-for-device
  588. set count=0
  589. :loop
  590. if "%~n1"=="" goto :endloop
  591. echo Installing %~n1
  592. adb install -r %1
  593. shift
  594. set /a count+=1
  595. goto :loop
  596. :endloop
  597. goto quit
  598. :logr
  599. cd other
  600. Start "Read The Log - Main script is still running, close this to return" signer 1
  601. goto restart
  602. :endab
  603. cd ..
  604. @echo Optimization complete for %~1
  605. :quit

comments powered by Disqus