4

I have an application that I built in Android Studio. It used to run just fine and has been released to the store in the past, but for some reason the Release APK won't run when installed. The debug runs fine run via phone or emulator. The debug and release builds both use the same keystore file.

Release mode, the APK crashes immediately on open. I suspect it is a keystore issue, but can't be positive??? Does debug bypass using my keystore even though I have it set?

Anything else that I could possibly try?

NOTE: I have another flavor that uses a different keystore and that one works fine.

Adam
  • 497
  • 2
  • 9
  • 29
  • Connect the phone to the pc via USB, have android studio open, go to Android Monitor, select your device and look at logcat. I am pretty sure, the exception is there, just waiting for someone to read it. Android Studio logcat logs even store apk's. so publish the release to your phone and just connect it – Grisgram Mar 23 '17 at 11:59
  • Have you used proguard? – Bhavishya Prajapati Mar 23 '17 at 12:11
  • Are you using proguard with release build. – Imran Ali Mar 23 '17 at 12:12
  • Grisgram.... post that as an answer and I will mark it. That helped me find the issue. Thanks! – Adam Mar 23 '17 at 13:08

5 Answers5

4

Have you used proguard? If yes I am dam sure its your proguard issue. I would suggest you please read proguard guideline before using it.

  • 1
    You can add proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' minifyEnabled true in your debug buildType in gradle, to check if it is a proguard issue. – ElOjcar Sep 15 '17 at 21:16
4

As requested here as answer :)

Connect the phone to the pc via USB, have android studio open, go to Android Monitor, select your device and look at logcat. I am pretty sure, the exception is there, just waiting for someone to read it. Android Studio logcat logs even store apk's. so publish the release to your phone and just connect it

Thank you, @Adam

Grisgram
  • 3,105
  • 3
  • 25
  • 42
  • Helped me. my problem was that the activity which crashed on its startup wasn't in the manifest file. It was stated clearly in the log (after I filtered to show errors only) – TheLogicGuy Jan 12 '18 at 21:50
1

It's not proguard. I spent almost two months with this issue of debug build working while release build doesn't work and messed with the proguard files countless times. The problem was instant run. After removing all references to instant run, it finally worked.

Vystyk
  • 11
  • 1
1

You may be able to get additional information by enabling the debugger during release mode. Take a look at this SO thread: Enable LogCat on Release Build in Android Studio. That way you'll be able to see a traceback of the error that's being thrown.

varogen
  • 746
  • 10
  • 21
0

In my case, while opening the release APK the app was crashing. The best way is to see the logcat for knowing the cause of Error. If you have not written any Proguard rules then just goto your build.gradle and change your "minifyEnabled false". This is because ProGuard is obfuscating your APK to make it harder for hackers to reverse-engineering your APK. If you think obfuscation is not needed, change this in your Gradle configuration.just look here.

Elletlar
  • 3,136
  • 7
  • 32
  • 38