summaryrefslogtreecommitdiff
path: root/android/BUILD
diff options
context:
space:
mode:
authorDiego Perez <diegoperez@google.com>2021-10-13 19:54:03 +0000
committerDiego Perez <diegoperez@google.com>2021-10-14 17:24:58 +0000
commit14ebbcfe218ea2e82164c3b31cf3ebbc37b5d129 (patch)
treea114f2d750ca6099dc599563e3afb56ae03dd2d4 /android/BUILD
parent47fb59d4ba009d5cfb1956bad8ec40ab9ea89b1a (diff)
downloadidea-14ebbcfe218ea2e82164c3b31cf3ebbc37b5d129.tar.gz
Fix regression in Android coroutines initialization
The kotlin coroutines core library will detect that is running in Android and try to load "AndroidDispatcherFactory" to create the coroutines dispatchers. By making it fail, we force the kotlinx.coroutines.internal.FastServiceLoader to fallback to the backup loading method. This method involves trying to find the right dispatcher factory by locating the kotlinx.coroutines.internal.MainDispatcherFactory service and instantiating it. We have our own implementation of that service and we declare it as part of the layoutlib-extensions module that is loaded as an external jar. The service will load the LayoutlibDispatcherFactory that implements a dispatcher adapter to run on layoutlib. Test: Added regression test Bug: 162056408 Change-Id: I546474c415c5eb26a2f63e217cf94802a7b3c224
Diffstat (limited to 'android/BUILD')
-rw-r--r--android/BUILD1
1 files changed, 1 insertions, 0 deletions
diff --git a/android/BUILD b/android/BUILD
index d29e6463b80..1dc46bfa0ca 100644
--- a/android/BUILD
+++ b/android/BUILD
@@ -221,6 +221,7 @@ iml_module(
"//prebuilts/studio/jdk",
"//prebuilts/studio/layoutlib:build.prop",
"//prebuilts/studio/layoutlib/data:framework_res.jar",
+ "//prebuilts/studio/layoutlib/data:layoutlib_extensions",
"//prebuilts/studio/layoutlib/data:native_libs",
"//prebuilts/studio/layoutlib/data/fonts",
"//prebuilts/studio/layoutlib/data/icu",