Skip to content

Commit 9af2571

Browse files
committed
Use android-support @keep annotation to avoid removal of AndroidExceptionPreHandler
Fixes #214 better
1 parent 2bc0a1b commit 9af2571

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,3 @@ To avoid field overloading by type during obfuscation, add this to your config:
107107
volatile <fields>;
108108
}
109109
```
110-
111-
You also need to keep this class if you build your Android releases with `minifyEnabled true`:
112-
113-
```
114-
-keep class kotlinx.coroutines.experimental.android.AndroidExceptionPreHandler
115-
```

ui/kotlinx-coroutines-android/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
repositories {
2+
google()
3+
}
4+
15
dependencies {
26
compileOnly 'com.google.android:android:4.1.1.4'
7+
compileOnly 'com.android.support:support-annotations:26.1.0'
38
}
49

510
tasks.withType(dokka.getClass()) {

ui/kotlinx-coroutines-android/src/main/kotlin/kotlinx/coroutines/experimental/android/AndroidExceptionPreHandler.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package kotlinx.coroutines.experimental.android
22

3-
import kotlinx.coroutines.experimental.CoroutineExceptionHandler
4-
import java.lang.reflect.Modifier
5-
import kotlin.coroutines.experimental.AbstractCoroutineContextElement
6-
import kotlin.coroutines.experimental.CoroutineContext
3+
import android.support.annotation.*
4+
import kotlinx.coroutines.experimental.*
5+
import java.lang.reflect.*
6+
import kotlin.coroutines.experimental.*
77

88
private val getter =
99
try {
@@ -20,6 +20,7 @@ private val getter =
2020
*
2121
* @suppress This is an internal impl class.
2222
*/
23+
@Keep
2324
class AndroidExceptionPreHandler :
2425
AbstractCoroutineContextElement(CoroutineExceptionHandler), CoroutineExceptionHandler
2526
{

0 commit comments

Comments
 (0)