1

In Android, what is the difference between debug build and production build ? Also are there any other kinds of builds ?

Thanks.

Jake
  • 16,329
  • 50
  • 126
  • 202

3 Answers3

2

I'm not sure if you are asking about the debug/production app or debug/product framework. So I will cover framework.

There are two different types of android framework build (the entire system image) user (aka production) and userdebug.

All standard device maker release their device with "user" build. Userdebug is meant for development and typically only built for in-house use.

Getting root:

In userdebug build you can simply do "adb root" to switch your adb shell to root mode. In addition, you can also do "adb remount" to remount the system partition to writeable mode for further control.

In user build, you can gain root access by installing special su binary and corresponding controlling app (like supersu). This way, while in adb shell, you can use "su" to gain a privileged shell. It is not as convenient as userdebug build.

In AOSP, you can choose the build type via the lunch command. For example lunch aosp_hammerhead-userdebug

vs

lunch aosp_hammerhead-user

Phuong Nguyen
  • 909
  • 7
  • 20
1

Well, the three little pigs had 3 types of builds but most of those didn't work out so well.

Anyway, you should see the docs here. When you build your app in the IDE you get a debug key and this is different than a production key. Having a debug build keeps you from needing to enter credentials each time but you obviously would want this prompt when you are ready to release a production build.

I guess this is what you are talking about but if you have something else in mind then please elaborate.

codeMagic
  • 44,549
  • 13
  • 77
  • 93
  • I was asking relating to debug v/s production build of AOSP. – Jake Apr 04 '14 at 01:29
  • Something like [this](http://stackoverflow.com/questions/13950589/difference-between-eng-and-user-debug-build-in-android)? You are still being very generic in your terminology, and question... You can develop AOSP software and it still apply to my answer or you could be talking about something a little different. – codeMagic Apr 04 '14 at 01:32
  • Actually its related to another question I asked about 'adb root' command. It requires debug build, so I wanted to understand the difference. – Jake Apr 04 '14 at 01:34
  • [See this answer](http://stackoverflow.com/questions/18369144/unable-to-run-adb-root-on-a-rooted-android-phone) – codeMagic Apr 04 '14 at 01:37
1

There is no difference between the two builds. The production build will run the same as the debug build with some limited exceptions. The limited exceptions relate to features that are signature dependent, i.e. they require you to register either the debug or production key to work properly. This would include most API's, like GoogleMaps or Facebook, and anything else that uses your build key to generate a unique identifier (think most OAuth2 products).

Your question is confusing/vague because in reality there is no difference in the two builds. Both will run exactly the same code. The difference is in who can run them and how you can run them. All android applications are signed when they are built by a unique key. This key identifies the app creator and is useful, in production, to ensure that the developer is not sending crap malware to those on the Google Play Store (or at least if they are we know where to find them).

Builds created in debug mode are signed with a debug key that is localized to a specific machine. This means if I build an app in debug mode to install to my phone, and another developer sitting right next to me builds the exact same code base to run on his phone our two applications will be signed with different debug keys. Why does this matter? Well, going back to the API registration process mentioned above, if I create our company wide Google Maps API registration using my debug key (bad idea) when my friend sitting next to me builds the app in debug mode on his machine he will encounter an error. The problem is that access to the Google Maps API is dependent on having an app installed that is registered with the right key. Because our two keys are different his app will not load properly.

Release/production mode allows you to sign the app is one universal key, not tied to a specific machine. This avoids the problem mentioned above. By using one key for all instals, every app will be able to access the same API's, so long as you register for them with your production key. This production key is not machine specific. You can send it to your friends (please don't) so they can sign apps as you.

That's pretty much it. You can read more about building and running apps here. If you have a more specific question please clarify.

Rarw
  • 7,645
  • 3
  • 28
  • 46