-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Android app with coroutines 0.30.1-eap13 crashes in runtime #657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you please provide a self-contained example? Or check why |
It is enough to start any coroutine in UI context. For example:
|
I did it in sample Android project and it works in both debug and release mode.
Again, works on my machine. Please be cooperative. I'm willing to help you, but I can't do anything with reports like "it doesn't work" |
It was my fault. I've excluded some Kotlin meta files from APK (specifically, Meta-inf/services/**). It was safe for previous coroutines version, but for 0.30.1 it became destructive. |
If an app is obfustacted with default proguard settings, it crashes in runtime. Here is sample project to reproduce an issue: https://www.dropbox.com/s/eay696h9qmxjl5e/sample.zip?dl=1
|
I had this bug when exported file apk when using proguard with the version 0.30.2. |
Those proguard rules didn't work for me, so I used this:
Definitely not a great solution since it tells proguard to keep everything, but it works. |
Same issue here with 0.30.2. |
The same issue with Android Studio 3.1.2 Didn't work:
Worked:
|
Thank you @trashkalmar for the reproducer. I have (ugly as hell) fix which first tries to lookup main dispatcher in service loader and then invokes |
…cher via Class.forName(..) if ServiceLoader failed to find dispatcher Fixes #657
This happens to me even without jetfier. Just proguard on its enough. |
It would be great if kotlinx.coroutines library could include proguard rules as part of distribution |
@bernaferrari then they need to be updated to
for kotlinx-coroutines-android |
Why?
…On Mon, Oct 22, 2018, 5:10 AM Anton Averin ***@***.*** wrote:
@bernaferrari <https://github.com/bernaferrari> then they need to be
updated to
-keepnames class kotlinx.** { *; }
for kotlinx-coroutines-android
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#657 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEESZtvZwmEJ_6n71AW3dhWe-e3j4cks5unYt6gaJpZM4XFs_r>
.
|
I have the same issue with 0.30.2 I also get default rule at Got the same message @trashkalmar
|
I still have error even though I used suggested ProGuard rules |
The suggested proguard rules should be enough. I mean:
I was recently facing this issue and realised that it was my fault and nothing to do with the proguard rules. Basically, we were re-signing the apk and removing the META-INF folder in the process. So, for the ones that are still facing the issue, please make sure that you are not doing the same (re-signing your apk and removing the META-INF folder after the release build is done). If that's the case, I would suggest you to generate an unsigned build and sign it afterwards. Just for reference, I'm using the version 1.0.1. Hope it helps. |
We were having this crash without even using ProGuard 😅 As mentioned by @djrsousa, it's because we were:
and replacing the META-INF folder in the process... |
In our case, we put |
@djrsousa thanks for spelling out the issue so well. Wished I had seen it before spending extra time researching the issue, but it was a good experience nonetheless.
Unless I am missing something, this should do the trick and be a very minimal change to the script people might be already running. Those files are the only ones that get added / modified when the signing occurs from what we could see. |
How can i sign the apk twice,but just replace the signature files in the META-INF folder? |
kotlinx-coroutines-android
is obviously added.Version 0.30.0-eap13 works fine.
The text was updated successfully, but these errors were encountered: