Last active
June 13, 2022 15:45
-
-
Save SeeFlowerX/363ab08eb8e9c1c8cce93cab12371821 to your computer and use it in GitHub Desktop.
将此bat放入Android Sdk的build-tools/{版本号}文件夹下 然后把jar拖到bat上即可转换到dex,原dx.bat逻辑和命令有问题,改了下方便转换,记得修改JAVA_HOME。
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 | |
setlocal | |
set prog=%~f0 | |
set JAVA_HOME=C:\Users\see\Documents\android-studio\jre | |
set java_exe=%JAVA_HOME%\bin\java.exe | |
set jarfile=dx.jar | |
set "frameworkdir=%~dp0" | |
set "frameworkdir=%frameworkdir:~0,-1%" | |
if exist "%frameworkdir%\%jarfile%" goto JarFileOk | |
set "frameworkdir=%~dp0lib" | |
if exist "%frameworkdir%\%jarfile%" goto JarFileOk | |
set "frameworkdir=%~dp0..\framework" | |
:JarFileOk | |
set "jarpath=%frameworkdir%\%jarfile%" | |
set javaOpts= | |
set args= | |
set defaultXmx=-Xmx1024M | |
set defaultXss=-Xss1m | |
set params= | |
:firstArg | |
if [%1]==[] goto endArgs | |
set a=%~1 | |
if [%defaultXmx%]==[] goto notXmx | |
if %a:~0,5% NEQ -JXmx goto notXmx | |
set defaultXmx= | |
:notXmx | |
if [%defaultXss%]==[] goto notXss | |
if %a:~0,5% NEQ -JXss goto notXss | |
set defaultXss= | |
:notXss | |
if %a:~0,2% NEQ -J goto notJ | |
set javaOpts=%javaOpts% -%a:~2% | |
shift /1 | |
goto firstArg | |
:notJ | |
set params=%params% --dex --output=%~n1.dex %1 | |
shift /1 | |
goto firstArg | |
:endArgs | |
set javaOpts=%javaOpts% %defaultXmx% %defaultXss% | |
call "%java_exe%" %javaOpts% -classpath "%frameworkdir%" -jar "%jarpath%" %params% | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment