1

I currently work on an Android application, and I messed around a bit with the VS.

I was wondering, what are the real differences between the two modes? I did some research, but I didn't completely get the real differences and the advantages of each one, as well as when to use a specific mode.

During my research, I came across those questions 1, 2 and 3, talking about the differences between the two.

  1. Why debug mode runs slower than release mode?
  2. When releasing an application to Google Play, which mode should I use and why?
  3. Can I create my own mode?

My app seems to be built fine in Debug mode, yet in Release mode I get a lot of warnings about "no debug symbols file was found".

  1. What are those debug symbols?
  2. What is the "81" folder in the obj/Debug or obj/Release?
  3. I also noticed that sometimes, when switching from Debug to Release, some Resource.Id are not found, and I need to recreate the axml file for the layouts plus cleaning the sln. How can I prevent it?

As I understood, debug mode uses some files that release mode doesn't need in order to run, I assume that the missing files are those "debug symbols"?. Maybe it's a problem with Xamarin or with VS? These are the warnings I get:

Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.v7.AppCompat.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Java.Interop.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Arch.Core.Common.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Arch.Lifecycle.Common.dll but no debug symbols file was found.         0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Arch.Lifecycle.Runtime.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Animated.Vector.Drawable.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Annotations.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Compat.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Core.UI.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Core.Utils.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Design.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Fragment.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Media.Compat.dll but no debug symbols file was found.          0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Transition.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.v4.dll but no debug symbols file was found.            0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.v7.RecyclerView.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.Android.Support.Vector.Drawable.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.GooglePlayServices.Base.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.GooglePlayServices.Basement.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.GooglePlayServices.Maps.dll but no debug symbols file was found.           0   
Warning     Directory obj\Release\81\android/assets contains Xamarin.GooglePlayServices.Tasks.dll but no debug symbols file was found.          0   
  1. Are those warning really something I need to worry about when releasing an app? Can they cause any further bugs?

I already tried:

  1. Deleting those files.

  2. Cleaning the solution and the whole project.

halfer
  • 19,824
  • 17
  • 99
  • 186
Daniel Reyhanian
  • 579
  • 4
  • 26

1 Answers1

5

I try to give you a brief overview and add some references. You won't come around to read some books or web pages.

The configurations are just labels for a specific set of settings you use for a build.

Practical example

Debug: For the developer to develop the app with alot of features which increases the development speed like full logging and debugging enabled DevelopmentRelease: For the testing team. Debugging disabled, Optimizations enabled, full logging, uses extensive crash reporting, uses test infrastructure (e.g test server) You can also use a different manifest in order that you have a different package name and can have the apps installed parallel. Release: Will be deployed to the playstore opting for performance and stability Debugging disabled, Reduced Logging, Optimized code, uses production infrastructure (eg. Server)

However it is up to you what setting you set for the specific configuration. By default the Release configuration will optimize the code to run faster. Also by default the Debug configuration has Debugging information full for Debug and pdb only for Release. But you won't be able to attach the debugger in a Release configuration with pdb only.

The pdb files are used to map the generated code to the source code. PDB Files: What Every Developer Must Know

To your questions:

1. Why debug mode runs slower than release mode?

Because some optimizations are done (optimize code flag) => changes your code to run faster. You probably won't feel this. There are also other performance benefits when no debugging is required for example no breakpoint resolution is required and so on.

2. When releasing an application to Google Play, which mode should I use and why?

Always take Release mode as this version usually runs faster and more stable. You probably have set in the Debug configuration use shared runtime: This deploys the mono runtime as a separate app to the device in order that the deployment in debug mode is faster => only changes from your code have to be deployed. However when you upload the Debug Version to the playstore the App won't run as the shared runtime App is missing. If you use Proguard for code obfuscation this is usually also a feature which is only enabled in Release mode. Proguard Home Page

If you have an automatic build pipeline you normally don't have to Release build on your local machine as this is done by the build server.

3. Can I create my own mode? Yes as I already mentioned. Press on the arrow next to the Configuration and open the configuration manager. In the configuration manager press the dropdown active configuration and select new. You can also copy a already existing configuration. => always have a look in the *.csproj file what the configuration contains. Visual Studio is not always able to copy all configurations entries.

4. What are those debug symbols?

You can ignore these warnings you don't need the pdb files for Code which isn't yours.

5. What is the "81" folder in the obj/Debug or obj/Release?

I don't know why you care about the obj folder but 81 contains android stuff for the version 8.1 which is used during the build

6. I also noticed that sometimes, when switching from Debug to Release, some Resource.Id are not found, and I need to recreate the axml file for the layouts plus cleaning the sln. How can I prevent it?

I also observed this behaviour in older visual studio versions. Currently I use VS 15.9.4 with Xamarin 4.3.12.77 and this works usually fine. The problem of the source is probably that Resource id's are generated during the build process. When you switch to release configuration these symbols have also to be generated for release and maybe VS messes things up.

7. Are those warning really something I need to worry about when releasing an app? Can they cause any further bugs?

Don't worry about this! Missing Pdb files will not cause you any trouble they are not bundled to the apk.

Before you upload your apk to the playstore I recommend reading the following Android Guideline Publish your app guide

eugstman
  • 978
  • 2
  • 15
  • 18
  • Excellent answer! In answer number 4, what do you mean not mine? And what is shared runtime App? – Daniel Reyhanian Feb 11 '19 at 15:43
  • @DanielReyhanian "code which is not yours" code which you have not written (Android code from google or nuget packages), Xamarin apps run in a mono runtime this runtime is packed into the apk in Release mode. In Debug it is deployed as a seperate app. See details: https://learn.microsoft.com/en-us/xamarin/android/deploy-test/app-package-size – eugstman Feb 12 '19 at 10:20