Difference between debug and release apks

孤街浪徒 提交于 2019-11-27 17:11:41

问题


I am new to android as well as android studio. From my experience in visual studio, when we test the .exe in another machine we copy the release folder and .exe.

But in android studio I am seeing my colleagues test the debug apk by copying and deploying in other systems using USB drive. seems working also. May I know what is the consequence of deploying that version? Is the release version relevant only for a play store purpose?

What is the technical difference/consequence other than that debug version contains debug information which may makes it slow or bulky?


回答1:


Major differences are the debug flag and the signing keys:

  • For debug builds the apk will be signed with the default debug signing keys with debug flag enabled.

  • For release keys you will have to explicitly specify the keys to sign with and the debug flag will be turned off so that it cannot be debugged.

  • Proguard can be turned on for release builds. (also for debug builds but not advised). This step needs to be done explicitly and is false by default.

Note: these things can be altered in your build.config and you can choose what ever permutation and combination you wish.




回答2:


One important difference is that release APKs typically have had ProGuard (code shrinking) run on them, which detects and removes unused code to reduce the APK size.

From Shrink Your Code and Resources:

Be aware that code shrinking slows down the build time, so you should avoid using it on your debug build if possible. However, it's important that you do enable code shrinking on your final APK used for testing, because it might introduce bugs if you do not sufficiently customize which code to keep.

Your colleagues are probably testing on the debug build type to save time, because it can take significantly longer to build the release APK as opposed to the debug APK.




回答3:


The primary difference (if specified otherwise in the build.gradle) between a debug build and a release build is the key with which they are signed. Most app distribution channels would [only] want an app signed with a release key to authenticate the developer. Otherwise, there are no differences.

A release build may also trigger other options like code obfuscation and splits so, look out for these.

However, there are many changes that can be brought about in between these two versions. These should be specified in your build.gradle, if any. So, you should keep an eye there.



来源:https://stackoverflow.com/questions/38864358/difference-between-debug-and-release-apks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!