Skip to content

Instantly share code, notes, and snippets.

@houtianze
Last active September 15, 2024 16:37
Show Gist options
  • Save houtianze/fc9f158fd86bb0b58c485139ddc32ece to your computer and use it in GitHub Desktop.
Save houtianze/fc9f158fd86bb0b58c485139ddc32ece to your computer and use it in GitHub Desktop.
Windows batch file to convert .java file to .smali
:: http://stackoverflow.com/a/29052019/404271
echo JDK 7 is required
if not x%1==x goto doit
:usage
echo %~n0 ^<Java file without .java extension^>
goto end
:doit
set ANDROID_SDK_DIR=%UserProfile%\AppData\Local\Android\android-sdk
set ANDROID_JAR=%ANDROID_SDK_DIR%\platforms\android-23\android.jar
set ANDROID_BUILD_TOOL_DIR=%ANDROID_SDK_DIR%\build-tools\23.0.3
javac -cp %ANDROID_JAR% %1.java
if errorlevel 1 goto end
cmd /c %ANDROID_BUILD_TOOL_DIR%\dx --dex --output=%1.dex %1.class
cmd /c baksmali -o . %1.dex
:end
@Beelucky
Copy link

@izgzhen can i build gradle with JRE old version only and not JDK- it?

because .bat CLi 2 smali very large on my cordova project as well...

@s0ubhik
Copy link

s0ubhik commented Nov 1, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment