I'm running the latest version of Android Studio (2.2 Preview 1) that was just released and trying to take advantage of some of the new tools.
The new APK Analyzer is very useful but I can't get it to work with debug builds, it only seems to be accurate for release builds.
Here is a screenshot of what the release build looks like, as you can see the method count looks accurate and all the android libraries that I am using are included.
Now, if I pull in the debug build of the same application it looks totally different. All of my application code is missing, as well as all the third party libraries. And you can see that the method count has also been reduced dramatically.
So am I doing something wrong here? How can I get this analyzation to take place on my debug builds as well?
Note via James Lau on G+:
tool was designed to help you understand and reduce the size of your release APK, since that is what you publish. As such, you probably want to run it on your Release APK. You can leave Instant Run turned on for building Release APK as Instant Run only works on Debug.
Android Studio 3.0 and higher allow you to profile and debug APKs without having to build them from an Android Studio project. However, you need to make sure you're using an APK with debugging enabled. To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen.
Drag an APK or app bundle into the Editor window of Android Studio. Switch to the Project perspective in the Project window and then double-click the APK in the default build/output/apks/ directory. Select Build > Analyze APK in the menu bar and then select your APK or app bundle.
Are you sure you have a complete debug build and not a APK file for an HOT or WARM SWAP?
Android Studio since 2.0 has a feature called "Instant Run" that allows to create some sort of "delta-APKs" for updating an app on-device after you made some small changes. The advantage is that you don't have to execute a full gradle build process and therefore such a HOT SWAP is much faster.
Those special HOT/WARM SWAP APKs include only the changes you made recently and some additional code for merging the created APK into the existing APK on-device.
Therefore you should try to execute "Rebuild project" or "Clean project" and see if the created debug APK is as you expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With