Skip to content

Instantly share code, notes, and snippets.

task(configs) << {
configurations.each { println it.name }
}
// ./gradlew libsize to list each lib size
task(libsize) << {
def size = 0;
configurations.<config>.collect { it.length() / (1024 * 1024) }.each { size += it }
println "Total dependencies size: ${Math.round(size * 100) / 100} Mb"
configurations
.<config>
.sort { -it.length() }
redex <input apk> -o <output apk>
brew install autoconf automake libtool python3
brew install boost jsoncpp
android {
buildTypes {
release {
minifyEnabled true
proguardFiles '../proguard.cfg'
}
}
...
}
<?xml version="1.0" encoding="UTF-8"?>
<resproguard>
<!--defaut property to set -->
<issue id="property">
<!--whether use 7zip to repackage the signed apk, you must install the 7z command line version in window -->
<!--sudo apt-get install p7zip-full in linux -->
<!--and you must write the sign data fist, and i found that if we use linux, we can get a better result -->
<seventzip value="true"/>
<!--the sign data file name in your apk, default must be META-INF-->
<!--generally, you do not need to change it if you dont change the meta file name in your apk-->
for apk in $(find ./<project path>/build/outputs/ -name '*.apk' );
do
printf "\nshrinking ${apk}\n"
java -jar andredguard/AndResGuard-cli-1.1.11.jar $apk -config ./andredguard/config.xml -zipalign ./andredguard/zipalign_unix
done
curl --output imageoptim-cli.zip https://codeload.github.com/JamieMason/ImageOptim-CLI/zip/1.14.8
unzip imageoptim-cli.zip
while [[ true ]]; do
echo "pull latest images"
git clone <git path> --branch <branch name> --single-branch
# step1, run imageOtim
./imageoptim -s -d ./<res path>
# step2, convert webp
# webp is not supported until 4.3 (api 18)
./gradlew clean lint<taskName>
LINT_PATH=$(find ./ -iname lint-results-**.xml)
# there's some issue on remover currently, need to move manifest manually
cp ./<ManifestPath>/AndroidManifest.xml AndroidManifest.xml
android-resource-remover --xml $LINT_PATH
# remove unused layout files
python rm_unused_res.py