Skip to content

Instantly share code, notes, and snippets.

@houtianze
Last active September 7, 2022 22:13
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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
@xoceunder
Copy link

I have problem with the conversion in windows 10

@waploaj
Copy link

waploaj commented Feb 3, 2018

@xoceunder did you manage to fix your issue

@redragon14368
Copy link

how to use it

@izgzhen
Copy link

izgzhen commented Dec 30, 2018

I wrote a java tool for doing this https://github.com/izgzhen/java2smali

@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