Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug an Android app that crashes only in Release Mode

Everything works in Debug Mode but Crashes in Release Mode. What required permissions are available in Debug Mode that are not turned on in Release mode?

EDIT

When I set Linking to None, I get past the first screen to my Login screen. However, when I added the Release permission Internet, the first time it tries to read a remote Entity Framework Core Table it crashes.

EDIT 2

In Release Mode, if I check Use Shared Runtime, the app runs fine.

EDIT 3

I have turned on Debugging while in Release mode Temporarily. The Following line throws a System.TypeInitializationException only in Release Mode:

if (_context.bma_users.Any(p => p.username == _name.Text) && _name.Text != string.Empty)
like image 807
Randy Avatar asked Aug 14 '18 14:08

Randy


People also ask

How do you fix a crashed app on Android?

You may have downloaded the app improperly, and all you need to do is to reinstall the app to fix the crashing problem: Go to Settings > “Apps” or “Application manager” > Choose the app that crashes > Tap the “Uninstall” option to make it. Then you can go to Google Play Store to reinstall the app after a few minutes.


3 Answers

IF YOU JUST WANT TO SEE THE CRASH LOG:

Assuming you have Android Studio and no crash report service implemented (Firebase, Crashlytics, etc...)

You might want to see the crash log print first:

  • Open the Logcat in Android Studio.
  • Change Log Level to Error.
  • Make sure USB debugging is enabled on your device.
  • Connect your device to the computer.
  • Make the app crash and see what it prints.

If you can't reproduce:

Next time it crashes, connect the device and do the same as above. Usually the log history will be available to view, scroll until you find the crash :)

Look for FATAL EXCEPTION

  • Keep in mind - using the Logcat search bar can clear the log history, in most cases you can reconnect your device to view it again.
like image 151
HedeH Avatar answered Oct 06 '22 02:10

HedeH


You already assume "permission", not sure why...

The first thing I disable when I have something crashing only in release mode is minify (aka ProGuard). So disable the obfuscation, build again and try to see if you still get crashes. If not, reenable proguard one line at a time to pinpoint the cause.

like image 44
WarrenFaith Avatar answered Oct 06 '22 03:10

WarrenFaith


The answer was to set Additional supported encodings to West in the Android Options screen under Project Properties. It doesn't seem related but I was trying every possible combination and this finally worked.

like image 40
Randy Avatar answered Oct 06 '22 02:10

Randy