Mar*_*nik 8 android kotlin kotlinx.coroutines
我kotlinx-coroutines-android:1.0.0-RC1
在我的Android项目中使用Kotlin 1.3 EAP .我的开发构建成功,应用程序运行正常.但是,当我Generate Signed APK
,应用程序仍然构建和运行,但随后崩溃
java.lang.IllegalStateException
:Main
缺少调度程序的模块.添加提供Main
调度程序的依赖项,例如'kotlinx-coroutines-android'
由于dev构建运行良好,显然gradle文件中没有遗漏.我有这些设置:
项目build.gradle
:
buildscript {
ext.kotlin_version = '1.3.0-rc-190'
....
Run Code Online (Sandbox Code Playgroud)
模块build.gradle
:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0-RC1'
Run Code Online (Sandbox Code Playgroud)
随着时间的推移,相同的应用程序已经与许多不同版本的实验协同程序一起运行,这是我第一次遇到这个问题.我怀疑EAP工件中有一些临时问题.
我有什么办法让这项工作成功?
如果您正在使用proguard,请添加这些proguard 规则.
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2190 次 |
最近记录: |