https://kotlinlang.org logo
#coroutines
Title
# coroutines
i

igorvd

08/29/2018, 12:58 PM
Hi, I'm trying to build an APK that uses coroutines... I'm getting an
Error while generating the main dex list
Running with the stacktrace, I can see that this is the cause:
Copy code
Caused by: com.android.tools.r8.errors.CompilationError: Program type already present: kotlinx.coroutines.experimental.AbstractContinuation
	at com.android.tools.r8.utils.ProgramClassCollection.resolveClassConflictImpl(ProgramClassCollection.java:64)
	at com.android.tools.r8.utils.ProgramClassCollection.lambda$create$0(ProgramClassCollection.java:25)
	at java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:1990)
	at com.android.tools.r8.utils.ProgramClassCollection.create(ProgramClassCollection.java:24)
	at com.android.tools.r8.graph.LazyLoadedDexApplication$Builder.build(LazyLoadedDexApplication.java:124)
	at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:123)
	at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:86)
	at com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:41)
	at com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:111)
	at com.android.builder.multidex.D8MainDexList.generate(D8MainDexList.java:83)
	... 56 more
Searching for jars that contains the
AbstractContinuation
, I can see that is present in:
org.jetbrains.kotlinx:kotlin-coroutines-core:0.25.0
org.jetbrains.kotlinx:kotlin-coroutines-core-common:0.25.0
But my only dependency in build.gradle is:
org.jetbrains.kotlinx:kotlinx-coroutines-android:0.25.0
I've notice that going back to version 0.23.4 fixed the problem. Maybe it's a bug with the version
0.25.0
. I can't test using the
0.24.0
, because I need the
runBlocking
in some parts.
d

dekans

08/29/2018, 1:32 PM
This is a building option not supported by Android build tools. https://github.com/Kotlin/kotlinx.coroutines/issues/510 No solution for now 😕 (exeption trying with AGP 3.3 which still is alpha)
👍🏼 1
i

igorvd

08/29/2018, 1:36 PM
😞 But I'm already using the AGP 3.3.0-alpha05, AS 3.3 canary and gradle 4.9.. Maybe I should stick with the 0.23.4 for a while...
d

dekans

08/29/2018, 1:46 PM
It seems that you need R8 to be enabled un your gradle.properties
From the comments of this issue. I stick to v0.24 until we have a fix 😞
i

igorvd

08/29/2018, 1:58 PM
I've checked with the r8 enabled 😕 Same problem
6 Views