visit
Android Studio introduces another quite useful tool that allows you to see what the resulting apk has produced - the Apk Analyzer.
Create an ApkAnalyzerActivity, insert the following code, and run the project:
class ApkAnalyserActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
Run the Apk Analyzer and select the current app-debug.apk:
If b didn't find it on its own, find it yourself at the following address:
A window with a list of files will open:
In it, you can find the familiar folders and files: res, assets, AndroidManifest.xml, as well as classes.dex files and folders with libraries, such as okhttp3. For this article, I specially inserted ApkAnalizerActivity into a large project, so that you can see the difference.
Go to the build.gradle file, insert multiDexEnabled falseand restart the project:
Note that there are fewer classes.dex files. In one of these files, at the package address of the current ApkAnalyzerActivity, you can find it.
Right-click it and chooseShow Bytecode:
You can view the bytecode of the current ApkAnalyzerActivity here:
Select AndroidManifest.xml from the list and view the contents of this file:
Note that AndroidManifest.xml is not only a version of the current application but a mortal version of the current application and all the modules and libraries that are part of it.
Go back to the build.gradle file, enable obfuscation (change the minifyEnabled true line), restart the project and open Apk Analyzer:
Click on any classes.dexfile:
Note that all files and methods have changed their names because of obfuscation and are now a random set of characters.
The Apk Analyzer is quite a powerful tool that should not be ignored during development. It is especially useful in cases where: