12.6 DrySister's Sister-Watching App (First Edition) — 6. Icon Creation, Obfuscation, Signing and Packaging, APK Slimming, App Release
Category Android Basic Tutorial
Don't ask me why the title is so long, why not make it shorter, I think you are
Although the code is finished, there are still quite a few follow-up operations for release, such as the title, The content of this section is in order: App Icon Creation, Obfuscation, Signing and Packaging APK, Apk Slimming, and App Release to the Cool Market. There is a lot of content, so let's not talk too much and start directly~
1. Icon Creation
I originally wanted to make one with Sketch myself, but I gave up after less than 10 minutes of exploration... I might as well directly use the icon generation tool built into AS to generate it with one click. The steps are as follows: right-click on the drawable folder -> new -> Image Asset, choose your favorite picture as the icon, such as my favorite outdated female second Rem, and then Next, then The pop-up window will follow the next step without thinking:
Then AS generated a bunch of files for us:
You might see this and wonder what the hell is this? What is this mipmap-anydpi-v26 folder? And why does each mipmap folder have an extra ic and ic
The reason is:
Android 8.0 (API 26) introduced adaptive launcher icons, which can display various shapes in different device models; It is actually to divide the original one-layer icon into two layers: background and foreground, and then different launchers have a Mask (translated as a mask, but I feel more appropriate as a mask layer), and then, different The mask layer can cut out different shapes, such as the circle in the example:
In addition to this method, there is also support for animation effects, such as two layers using different sliding speeds:
I heard that Android 8.0 can long press the desktop to modify the icon shape, and I tried the 8.0 emulator I didn't find the related option; some people say it's the Pixel Launcher, I downloaded several versions and found It's not there, I guess it should be the Launcher that comes with the Pixel series that can be modified. I compared it with Nova Launcher and the 8.0 launcher, and I can also see the difference:
For more information, please refer to the official website: Adaptive Icons Just know what's going on, if you don't like it, you can delete all the files and only keep one ic_launcher.png.
2. Obfuscation
Before releasing the app, obfuscating the code can make our code difficult to read even if it is decompiled. AS itself integrates Java's ProGuard as a compression, Optimization and obfuscation tool, the obfuscation rules file is: proguard-rules.pro, to enable Obfuscation rules, just change minifyEnabled to true in build.gradle to enable obfuscation. In addition to being able to obfuscate the code, ProGuard can also reduce the size of the app, and bytecode level optimization makes our APP run faster! In addition, after obfuscation, a mapping.txt obfuscation rule file will be generated by default in app/build/outputs/mapping/release, which can be used to deduce the code before obfuscation; There are also some places that need to avoid obfuscation, otherwise, the APP will make a mistake when running.
Due to space limitations, I will not explain the obfuscation rules here, if you are interested, you can go to: Android Obfuscation from Entry to Mastery Here I will directly use the common template on the Internet, if it is a third party, the official document generally There are obfuscation rules, just copy and paste, the common template is as follows:
```
Specify the compression level
-optimizationpasses 5
Do not skip the class members of non-public libraries
-dontskipnonpubliclibraryclassmembers
The algorithm used during obfuscation
-optimizations !code/simplification/arithmetic,!field/,!class/merging/
Obfuscate the method names in
1.8 Project-Related Analysis (Various Files, Resource Access)
2.5.4 Basic Use of AutoCompleteTextView (Auto-Complete Text Box)
[2.5.8 Detailed Explanation of Notification (Status Bar Notification)](android-tutorial
6.2 Data Storage and Access - SharedPreferences for Saving User Preferences
6.3.1 Data Storage and Access - An Introduction to SQLite Database
6.3.2 Data Storage and Access - Another Look at SQLite Database
7.1.1 What to Learn in Android Network Programming and Study of Http Protocol
7.1.2 Learning About Android Http Request and Response Headers
8.3.4 Paint API - Detailed Explanation of Xfermode and PorterDuff (Part 1)
8.3.5 Paint API - Detailed Explanation of Xfermode and PorterDuff (Part 2)
8.3.6 Paint API - Detailed Explanation of Xfermode and PorterDuff (Part 3)
8.3.7 Paint API - Detailed Explanation of Xfermode and PorterDuff (Part 4)
8.3.8 Paint API - Detailed Explanation of Xfermode and PorterDuff (Part 5)
[8.3.12
- 12.6 DrySister Viewing Girls App (First Edition) — 6. Icon Creation, Obfuscation, Signing and Packaging, APK Slimming, App Publishing