From 74c9e56a505882a68c9d300ce84714ef96f6d970 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Thu, 14 Sep 2023 20:51:49 +0000 Subject: Exclude DebugProbesKt.bin from kotlinx_coroutines ressources This is only used by the debugger and is causing issues to generate coverage for robolectric tests using this library Bug: 291743544 Test: java -jar jacoco-cli.jar report coverage.ec --classfiles host/testcases/ServiceBluetoothRoboTests/ServiceBluetoothRoboTests.jar --html coverage --name coverage.html Change-Id: Ia6530d180211858b3a94aef2b997c05fb7994a2e --- Android.bp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Android.bp b/Android.bp index ee7cb03e..ef396c7a 100644 --- a/Android.bp +++ b/Android.bp @@ -50,6 +50,13 @@ java_library_host { "kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt", ], java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"], + // See https://github.com/Kotlin/kotlinx.coroutines#avoiding-including-the-debug-infrastructure-in-the-resulting-apk + // This file contains `kotlin.coroutines.jvm.internal.DebugProbesKt` class and is only used + // by the debugger. + // This cause issues when generating coverage as Jacoco will fail with + // `Caused by: java.lang.IllegalStateException: Can't add different class with same name: kotlin/coroutines/jvm/internal/DebugProbesKt` + // See b/291743544 for more details + exclude_java_resources: ["kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin"], static_libs: [ "kotlinx_atomicfu", ], -- cgit v1.2.3