Skip to content

Instantly share code, notes, and snippets.

@JonnyBanana
Forked from houtianze/java2smali.bat
Created October 3, 2018 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonnyBanana/4f0a0cb9a56b646749ef152de11529bf to your computer and use it in GitHub Desktop.
Save JonnyBanana/4f0a0cb9a56b646749ef152de11529bf 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment