Dizzy Dream of Android Development

These are my personal notes.

Sign APK

1. Generate Keystore (Only Once)

1
keytool -genkey -v -keystore chaos.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app

2. Zipalign

1
/home/chaos/Android/Sdk/build-tools/26.0.1/zipalign -p -v 4 '/home/chaos/Websites/App/chaos/app-release.apk' '/home/chaos/Websites/App/chaos/chaos-1.0.6-aligned.apk'

3.Sign & Verify

The script file can be found in %ANDROID_HOME%/sdk/build-tools/24.0.3/ (the .jar is in the /lib subfolder). Use it like this

1
/home/chaos/Android/Sdk/build-tools/26.0.1/apksigner sign --ks '/home/chaos/.apkstudio/vendor/chaos.keystore' --out '/home/chaos/Websites/Nethunter/themes/Dreamhunter/source/app/download/chaos-1.0.6.apk'  '/home/chaos/Websites/App/chaos/chaos-1.0.6-aligned.apk' 

Verify:

1
/home/chaos/Android/Sdk/build-tools/26.0.1/apksigner verify '/home/chaos/Websites/App/chaos/chaos-1.0.6.apk'

Decomplie

Tools

Apktool:

1
2
apktool d chaos.apk
apktool b chaos

Apk Studio:

1
'/home/chaos/Softwares/APK Studio/apkstudio/apkstudio'
Install Qt5 on Debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
apt install qt5-default qttools5-dev-tools
``

### Replace and Delete something

Keywords: license, License, *link*

cd /home/chaos/Websites/App/chaos/app-release/

- io/xxxxx/android/a/a$c.smali, etc.

- Remove the link, array-data

- sed -i s/Toast/Toastr/g \`grep Toast -rl ./`

- Except `android/d.smali` and `android/d$c.smali`

Commands:

``` bash
sed -i s/Toast/Toastr/g `grep Toast -rl /home/chaos/Websites/App/chaos/app-release/`
grep -r xxxx.io /home/chaos/Websites/App/chaos/app-release/

Check Download Permisson:

1
2
grep -r download /home/chaos/Websites/App/chaos/app-release/
grep -r Download /home/chaos/Websites/App/chaos/app-release/

Summary

  1. Decomplie

  2. Remove a$c.smali link and array_data

  3. Turn Toast to Toastr in a$c.smali

  4. Remove b$a.smali link

  5. Remove b$b.smali link

  6. Remove v.smali link

  7. Build

  8. Sign

Mastodon