-
Notifications
You must be signed in to change notification settings - Fork 1.9k
kotlinx-coroutines-android needs more Proguard rules to avoid having META-INF/services removed #983
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
This is very strange. It seems to be some bug in your updated toolchain, as both those classes are marked with Android's |
Turns out the annotations library shipped the wrong rules which didn't reference it's own types correctly. It's already been fixed but not yet released. I'll see if I can push a dot release through. Additionally, I'm |
Jake, are default agp proguard rules valid or are also wrong?
For AGP 3.3.1 I see inside
|
Those are fine
…On Tue, Feb 12, 2019 at 9:52 AM Sergii Pechenizkyi ***@***.***> wrote:
Jake, are default agp proguard rules valid or are also wrong?
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt' or 'proguard-android.txt'), 'proguard-project.txt'
For AGP 3.3.1 I see inside proguard-android.txt next lines:
# Understand the @keep support annotation.
-keep class android.support.annotation.Keep
-keep class androidx.annotation.Keep
-keep @android.support.annotation.Keep class * {*;}
-keep @androidx.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
@androidx.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@androidx.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <init>(...);
}
-keepclasseswithmembers class * {
@androidx.annotation.Keep <init>(...);
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#983 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEfFqRYsA8jWAWWF5nN5e29UcHYrWks5vMtUigaJpZM4a2UzP>
.
|
Now that I'm at a computer, when R8 runs in full mode it might collapse the service interface and single implementation together. It does this despite the When the types are merged, the call to But again, that being said, I am emploring the R8 team to do away with all this nonsense such that calls to |
Hello @qwwdfsad @JakeWharton , I am finding the same issue now with Android Studio 3.4.0, gradle plugin 3.4.0, R8 full mode explicitly disabled, coroutines 1.2.1, and R8 v1.4.77 (build b74371231cb896b02f83285efb055b7c00ff64d8). Building it and exporting it through the commandline (and minifying the code), installing it, ... will lead to the same crash at the top of this Issue.
gradle.properties file:
ADB crashlog:
Could this bug be reopened please? Should I also open an issue on the R8 bug tracker? Kind Regards, Goffredo |
Getting same issue : any update? |
#657 (comment) does it helps? @Panajev could you please attach a reproducing project? |
Hey @qwwdfsad , Sorry for not replying earlier, but thanks for the followup. We found the issue and it was related to our manual signing process which was perhaps the oldest legacy code we had in our Android codebase. We solved with some research before seeing that comment, but yeah it would have lead to #657 (comment) which is spot on:
The problem was due to this step in the signing+aligning phase (I presume to make it easy to resign it):
(moved away from it and modernised that path finally, signging, zipping, and aligning production builds through gradle signing properties...while a quick and dirty fix would have been [I tested it and it was working]:
as those are the only files created / modified during the jarsigner signing phase... As far as I know, luckily, this was the first case where the application had a runtime issue due to this. Thank you again for following up to my message! Kind Regards, Goffredo |
Still seeing this issue with AGP 3.5.0 and Coroutines 1.3.0 @Panajev Your message saved me countless hours! That was my issue too! |
We recently bumped our kotlin-coroutines version and our production (Proguard) build started crashing.
In addition to the proguard rules currently documented as being necessary, I also had to add the following Proguard rules:
Without these, the
META-INF/services
files provided by kotlinx-coroutines-android were being removed by proguard, causing the following error message:The text was updated successfully, but these errors were encountered: