Skip to content

Commit

Permalink
Reduce size to 1497 bytes
Browse files Browse the repository at this point in the history
Use smallest possible manifest, use DSA keystore with keysize=512
  • Loading branch information
madisp committed Oct 10, 2017
1 parent 1094f90 commit ff11ab2
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/build/
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
# ApkGolf
This repository hosts the smallest Android APK in the world. The current size of the APK is *1757 bytes*.
This repository hosts the smallest Android APK in the world. The current size of the APK is *1497 bytes*.

To learn more about how this was achieved, please read the [blog post](https://fractalwrench.co.uk/posts/playing-apk-golf-how-low-can-an-android-app-go/).

Expand Down
Binary file modified app/AndroidManifest.xml
Binary file not shown.
Empty file removed app/classes.dex
Empty file.
Binary file added app/keystore.jks
Binary file not shown.
29 changes: 29 additions & 0 deletions build.sh
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

rm -rf build
mkdir -p build/apk

set -x

#TODO ensure that ANDROID_HOME is set

echo "Creating base AndroidManifest.xml"
$ANDROID_HOME/build-tools/26.0.2/aapt p -M app/AndroidManifest.xml -I $ANDROID_HOME/platforms/android-26/android.jar -f -F build/base.apk
unzip build/base.apk -d build/apk

echo "Creating empty classes.dex"
touch build/apk/classes.dex

echo "Creating unsigned archive"
zip -j -r build/app-unsigned.apk build/apk

KEYSTORE_PASS=android $ANDROID_HOME/build-tools/26.0.2/apksigner sign --v1-signing-enabled false --ks app/keystore.jks --out build/signed-release.apk --ks-pass env:KEYSTORE_PASS --ks-key-alias android build/app-unsigned.apk

set +x

echo
echo
echo
echo "#######################################"
echo "RESULTING APK SIZE: $(stat -f '%z' build/signed-release.apk)"

Binary file modified signed-release.apk
Binary file not shown.

0 comments on commit ff11ab2

Please sign in to comment.