Skip to content

Instantly share code, notes, and snippets.

@houtianze
Created April 12, 2016 00:53
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 houtianze/7ec02de9c8c5f5966ecd2ddbdaa0fb73 to your computer and use it in GitHub Desktop.
Save houtianze/7ec02de9c8c5f5966ecd2ddbdaa0fb73 to your computer and use it in GitHub Desktop.
A simple Windows batch file to build apk from a smali directory
:: you need to have apktool in your path
if not x%1==x goto doit
:usage
echo %~n0 ^<smali dir^>
goto end
:doit
set EXTRA_SIGN_AGS=
if not x%KEYPASS%==x set EXTRA_SIGN_AGS=-storepass %KEYPASS% -keypass %KEYPASS%
set UNSIGNED_APK=%1-unsigned.apk
set UNALIGNED_APK=%1-unaligned.apk
cmd /c apktool -f b %1 -o %UNSIGNED_APK%
if errorlevel 1 goto end
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore apk.keystore %EXTRA_SIGN_AGS% -signedjar %UNALIGNED_APK% %UNSIGNED_APK% apk.hacking
zipalign -f -v 4 %UNALIGNED_APK% %1.apk
goto end
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment