52

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?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
UB_Roy
  • 651
  • 1
  • 6
  • 12
  • As the name suggests debug apk's are debug-able in our IDE.Which makes it easier to solve the issues in our app.Also release apk is signed with a keystore made by developer itself with his/her pass hence more secure. – Sunil Sunny Aug 10 '16 at 05:11

4 Answers4

23

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.

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
  • As far as I can understand from all the above answers, I may conclude that, a debug build is actually a fully self contained apk version which is even deployable in a production environment with the limitation of lacking some code compression/optimization/shrinking plus developer authentication. Thanks and please correct me if I am wrong in that conclusion. – UB_Roy Aug 10 '16 at 05:24
  • 2
    yes, apk signing is what i would say is the most important when releasing in production. other stuff can be applied to both build types. – Viral Patel Aug 10 '16 at 05:25
  • *"and the debug flag will be turned off so that it cannot be debugged"* ... does it mean "debug builds" can be debugged by other people? And they access app's codes ? – Shafizadeh Jan 08 '17 at 06:06
  • 3
    @Shafizadeh release apks must be decompressed and manually modified and recompressed+resigned by debug certificate, to be debuggable by other people. Accessing code is always available for every user, the release is "obfuscated", not "blocked". You can't hide code from user, who must be able to run the code, at some stage the code must be available to user, and at that moment skilled user can copy the code and explore/reverse engineer. "Obfuscation" is only making the process more difficult. – Ped7g May 17 '18 at 13:25
  • So if I manually sign a debug APK with my signature (as I've been doing for testing) and manually enable ProGuard on it and stuff, it's basically a production-ready APK on which the only difference between it an an actual release APK is the fact that it can be debugged - am I right? Or I misunderstood? – Edw590 Jul 01 '21 at 00:48
14

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.

prfarlow
  • 3,624
  • 2
  • 15
  • 24
9

The all above answers are correct BUT the major difference is that if we use the debug.apk to install the app on the device/emulator we can

*Debug it with debuuger

*Profile the cpu, memory, network with android studio profiler

*See the logs in the logcat

*Debug the layout with layout inspector

if use release.apk we can't use the above features, and we configure some features/libraries to work in specific out put type (Like we can use leakCanary only in debug apk)

4

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.

Shaishav
  • 5,282
  • 2
  • 22
  • 41