Skip to content

Commit c4c59db

Browse files
Fix crash related to Add Proguard rules for Kotlin Coroutines (#1857)
User reported crash: ``` java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' ``` Based on comments in related GitHub ticket, attempting to see if downgrading `kotlinx-coroutines` to `1.3.0` [0] and adding Proguard rules [1] fixes the issue. [0] Kotlin/kotlinx.coroutines#1532 (comment) [1] Kotlin/kotlinx.coroutines#1532 (comment) Fixes #1856
1 parent c64c0b4 commit c4c59db

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ext {
4444
compileSdkVersion = 29
4545

4646
javaAnnotationVersion = "1.0"
47-
coroutineVersion = '1.3.2'
47+
coroutineVersion = '1.3.0'
4848
}
4949

5050
if (JavaVersion.current().isJava8Compatible()) {

stripe/proguard-rules.txt

+12
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@
88

99
-keep class com.stripe.android.** { *; }
1010
-dontwarn com.stripe.android.view.**
11+
12+
13+
# Rules for Kotlin Coroutines
14+
# https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/kotlinx-coroutines-android/example-app/app/proguard-rules.pro
15+
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
16+
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
17+
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
18+
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
19+
20+
-keepclassmembernames class kotlinx.** {
21+
volatile <fields>;
22+
}

0 commit comments

Comments
 (0)