haroldadmin / WhatTheStack

See a pretty error screen when your Android app crashes
Apache License 2.0
245 stars 22 forks source link

Error screen does not work with minifyEnabled = true #21

Closed pandulapeter closed 4 years ago

pandulapeter commented 4 years ago

Hi,

Great idea with the library! Unfortunately I cannot make it work on minified builds: the Service simply doesn't get the message to start the Activity. I can reproduce the issue by building the release variant of the demo app in this repository, without modifying anything. Devices: OnePlus 3T (Android 9), Galaxy Note 10+ (Android 10)

I've spent some time trying to fix this as I'm working on something similar, but couldn't make it work. I tried starting the service in different ways (starting the Activity in onStartCommand()) which, again, works in debug builds but not after enabling minification. @Keep-ing every relevant class didn't fix the issue either.

Is there a limitation regarding ProGuard I wasn't aware of?

Thanks, Peter

haroldadmin commented 4 years ago

Can you confirm if you are using minification on debug builds or on release builds? The documentation suggests adding this library as a debug dependency with debugImplementation, so it is not present in the release builds and will not work there.

If you do want to use it in release builds, you should be able to change debugImplementation to just implementation.

pandulapeter commented 4 years ago

Thanks for the quick reply!

1) I'm stupid, your library works perfect if I change the debugImplementation keyword to implementation. 2) My code didn't work in minified builds because of the way I was communicating between the service and the activity - still not sure what's happening there but that isn't related to WhatTheStack.

Thanks again :)

haroldadmin commented 4 years ago

No problem. It looks like I can probably improve a little bit on this area in the documentation.