Рендеринг предварительных просмотров KMM в модулеAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Рендеринг предварительных просмотров KMM в модуле

Сообщение Anonymous »

Я пытаюсь модулизировать мобильное приложение Kotlin Multiplatform. 2024.3.2. Патч 1, сборка #AI-243.26053.27.2432.13536105, с версией плагина KMM 0.8.5 (243) -7 (самый последний доступный для Meerkat). < /P>
Я создал новый модуль, и я испытываю, чтобы я был уверен, что я делаю это правильно, прежде чем я просто начну переместить фактический код. Композитный и предварительный просмотр, и я хочу убедиться, что предварительный просмотр работает до того, как я двинусь вперед.

Код: Выделить всё

package com.example.ui

import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import org.jetbrains.compose.ui.tooling.preview.Preview

@Composable
fun TaskSelectorCard() {
Card {
Text(text = "Hello")
}
}

@Preview
@Composable
fun TaskSelectorCardPreview() {
MaterialTheme {
Scaffold {
TaskSelectorCard()
}
}
}
Я начал с build build.gradle.kts , который создается «Новым модулем»-> «Котлин мультиплатформенный общий модуль», а затем я добавил конфигурацию Compose на основе основного модуля приложения, так что он выглядит так:

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidKotlinMultiplatformLibrary)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
}

kotlin {
androidLibrary {
namespace = "com.example.ui"
compileSdk = libs.versions.android.compileSdk.get().toInt()
minSdk = libs.versions.android.minSdk.get().toInt()

withHostTestBuilder {
}

withDeviceTestBuilder {
sourceSetTreeName = "test"
}.configure {
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "example-uiKit"
}
}

sourceSets {
commonMain {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.kotlin.stdlib)
}
}

commonTest {
dependencies {
implementation(libs.kotlin.test)
}
}

androidMain {
dependencies {
implementation(compose.preview)
implementation(compose.uiTooling)
implementation(libs.androidx.activity.compose)

implementation("androidx.customview:customview-poolingcontainer:1.1.0")
}
}

getByName("androidDeviceTest") {
dependencies {
implementation(libs.androidx.runner)
implementation(libs.androidx.core)
implementation(libs.androidx.testExt.junit)
}
}

iosMain {
dependencies {
}
}
}
}

Я должен был добавить реализацию ("androidx.customview: customview-poolingcontainer: 1.1.0") (уже включенная выше) до источников. Androidmain.Epectendenties , чтобы обойти эту ошибку:

Код: Выделить всё

Failed to instantiate one or more classes

The following classes could not be instantiated:

- androidx.compose.ui.tooling.ComposeViewAdapter

Exception Details
java.lang.ClassNotFoundException: androidx.customview.poolingcontainer.PoolingContainerListener
  at java.lang.ClassLoader.loadClass  at java.lang.ClassLoader.loadClass  at androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool.installFor   ...
(ViewCompositionStrategy.android.kt:98)
  at androidx.compose.ui.platform.AbstractComposeView.(ComposeView.android.kt:130)
  at androidx.compose.ui.platform.ComposeView.(ComposeView.android.kt:421)
  at androidx.compose.ui.platform.ComposeView.(ComposeView.android.kt:420)
  at androidx.compose.ui.tooling.ComposeViewAdapter.(ComposeViewAdapter.android.kt:129)
  at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance  at java.lang.reflect.Constructor.newInstanceWithCaller  at java.lang.reflect.Constructor.newInstance  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:849)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:433)
Теперь я получаю еще одну ошибку, которая вызвана текстом composable (т.е. при удалении этого композиции, предварительный просмотр загружается, показывая пустую карту):

Код: Выделить всё

Render Problem

java.lang.NoClassDefFoundError:  a n d r o i d x / e m o j i 2 / t e x t / E m o j i C o m p a t < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . t e x t . p l a t f o r m . D e f a u l t I m p l . & l t ; i n i t & g t ; ( E m o j i C o m p a t S t a t u s . a n d r o i d . k t : 6 5 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . t e x t . p l a t f o r m . E m o j i C o m p a t S t a t u s . & l t ; c l i n i t & g t ; ( E m o j i C o m p a t S t a t u s . a n d r o i d . k t : 3 3 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . t e x t . p l a t f o r m . A n d r o i d P a r a g r a p h I n t r i n s i c s . & l t ; i n i t & g t ; ( A n d r o i d P a r a g r a p h I n t r i n s i c s . a n d r o i d . k t : 7 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . t e x t . p l a t f o r m . A n d r o i d P a r a g r a p h I n t r i n s i c s _ a n d r o i d K t . A c t u a l P a r a g r a p h I n t r i n s i c s ( A n d r o i d P a r a g r a p h I n t r i n s i c s . a n d r o i d . k t : 1 8 3 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . t e x t . P a r a g r a p h I n t r i n s i c s K t . P a r a g r a p h I n t r i n s i c s ( P a r a g r a p h I n t r i n s i c s . k t : 1 2 6 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . t e x t . m o d i f i e r s . P a r a g r a p h L a y o u t C a c h e . s e t L a y o u t D i r e c t i o n ( P a r a g r a p h L a y o u t C a c h e . k t : 2 3 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . t e x t . m o d i f i e r s . P a r a g r a p h L a y o u t C a c h e . l a y o u t T e x t - K 4 0 F 9 x A $ f o u n d a t i o n _ r e l e a s e ( P a r a g r a p h L a y o u t C a c h e . k t : 2 5 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . t e x t . m o d i f i e r s . P a r a g r a p h L a y o u t C a c h e . l a y o u t W i t h C o n s t r a i n t s - K 4 0 F 9 x A ( P a r a g r a p h L a y o u t C a c h e . k t : 1 4 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . t e x t . m o d i f i e r s . T e x t S t r i n g S i m p l e N o d e . m e a s u r e - 3 p 2 s 8 0 s ( T e x t S t r i n g S i m p l e N o d e . k t : 3 5 5 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . k t : 1 9 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t $ C o m p a n i o n . o b s e r v e ( S n a p s h o t . k t : 5 0 1 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r $ O b s e r v e d S c o p e M a p . o b s e r v e ( S n a p s h o t S t a t e O b s e r v e r . k t : 4 6 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r . o b s e r v e R e a d s ( S n a p s h o t S t a t e O b s e r v e r . k t : 2 4 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 2 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e M e a s u r e S n a p s h o t R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 0 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . p e r f o r m M e a s u r e - B R T r y o 0 $ u i _ r e l e a s e ( M e a s u r e P a s s D e l e g a t e . k t : 4 2 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . r e m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 7 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 5 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . l a y o u t . R o w C o l u m n M e a s u r e P o l i c y K t . m e a s u r e ( R o w C o l u m n M e a s u r e P o l i c y . k t : 1 2 6 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . l a y o u t . R o w C o l u m n M e a s u r e P o l i c y K t . m e a s u r e $ d e f a u l t ( R o w C o l u m n M e a s u r e P o l i c y . k t : 7 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . l a y o u t . C o l u m n M e a s u r e P o l i c y . m e a s u r e - 3 p 2 s 8 0 s ( C o l u m n . k t : 2 0 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . I n n e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( I n n e r N o d e C o o r d i n a t o r . k t : 1 2 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t $ C o m p a n i o n . o b s e r v e ( S n a p s h o t . k t : 5 0 1 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r $ O b s e r v e d S c o p e M a p . o b s e r v e ( S n a p s h o t S t a t e O b s e r v e r . k t : 4 6 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r . o b s e r v e R e a d s ( S n a p s h o t S t a t e O b s e r v e r . k t : 2 4 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 2 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e M e a s u r e S n a p s h o t R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 0 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . p e r f o r m M e a s u r e - B R T r y o 0 $ u i _ r e l e a s e ( M e a s u r e P a s s D e l e g a t e . k t : 4 2 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . r e m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 7 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 5 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . l a y o u t . B o x M e a s u r e P o l i c y . m e a s u r e - 3 p 2 s 8 0 s ( B o x . k t : 1 4 5 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . I n n e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( I n n e r N o d e C o o r d i n a t o r . k t : 1 2 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . g r a p h i c s . S i m p l e G r a p h i c s L a y e r M o d i f i e r . m e a s u r e - 3 p 2 s 8 0 s ( G r a p h i c s L a y e r M o d i f i e r . k t : 6 4 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . k t : 1 9 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t $ C o m p a n i o n . o b s e r v e ( S n a p s h o t . k t : 5 0 1 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r $ O b s e r v e d S c o p e M a p . o b s e r v e ( S n a p s h o t S t a t e O b s e r v e r . k t : 4 6 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r . o b s e r v e R e a d s ( S n a p s h o t S t a t e O b s e r v e r . k t : 2 4 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 2 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e M e a s u r e S n a p s h o t R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 0 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . p e r f o r m M e a s u r e - B R T r y o 0 $ u i _ r e l e a s e ( M e a s u r e P a s s D e l e g a t e . k t : 4 2 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . r e m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 7 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 5 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . m a t e r i a l 3 . S c a f f o l d K t $ S c a f f o l d L a y o u t $ 1 $ 1 . i n v o k e - 0 k L q B q w ( S c a f f o l d . k t : 2 6 3 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . m a t e r i a l 3 . S c a f f o l d K t $ S c a f f o l d L a y o u t $ 1 $ 1 . i n v o k e ( S c a f f o l d . k t : 1 4 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . l a y o u t . L a y o u t N o d e S u b c o m p o s i t i o n s S t a t e $ c r e a t e M e a s u r e P o l i c y $ 1 . m e a s u r e - 3 p 2 s 8 0 s ( S u b c o m p o s e L a y o u t . k t : 7 5 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . I n n e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( I n n e r N o d e C o o r d i n a t o r . k t : 1 2 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t $ C o m p a n i o n . o b s e r v e ( S n a p s h o t . k t : 5 0 1 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r $ O b s e r v e d S c o p e M a p . o b s e r v e ( S n a p s h o t S t a t e O b s e r v e r . k t : 4 6 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r . o b s e r v e R e a d s ( S n a p s h o t S t a t e O b s e r v e r . k t : 2 4 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 2 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e M e a s u r e S n a p s h o t R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 0 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . p e r f o r m M e a s u r e - B R T r y o 0 $ u i _ r e l e a s e ( M e a s u r e P a s s D e l e g a t e . k t : 4 2 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . r e m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 7 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 5 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . f o u n d a t i o n . l a y o u t . B o x M e a s u r e P o l i c y . m e a s u r e - 3 p 2 s 8 0 s ( B o x . k t : 1 4 5 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . I n n e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( I n n e r N o d e C o o r d i n a t o r . k t : 1 2 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . g r a p h i c s . S i m p l e G r a p h i c s L a y e r M o d i f i e r . m e a s u r e - 3 p 2 s 8 0 s ( G r a p h i c s L a y e r M o d i f i e r . k t : 6 4 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . m e a s u r e - B R T r y o 0 ( L a y o u t M o d i f i e r N o d e C o o r d i n a t o r . k t : 1 9 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 9 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e $ p e r f o r m M e a s u r e B l o c k $ 1 . i n v o k e ( M e a s u r e P a s s D e l e g a t e . k t : 1 6 8 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t $ C o m p a n i o n . o b s e r v e ( S n a p s h o t . k t : 5 0 1 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r $ O b s e r v e d S c o p e M a p . o b s e r v e ( S n a p s h o t S t a t e O b s e r v e r . k t : 4 6 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . r u n t i m e . s n a p s h o t s . S n a p s h o t S t a t e O b s e r v e r . o b s e r v e R e a d s ( S n a p s h o t S t a t e O b s e r v e r . k t : 2 4 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 2 4 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . O w n e r S n a p s h o t O b s e r v e r . o b s e r v e M e a s u r e S n a p s h o t R e a d s $ u i _ r e l e a s e ( O w n e r S n a p s h o t O b s e r v e r . k t : 1 0 7 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . p e r f o r m M e a s u r e - B R T r y o 0 $ u i _ r e l e a s e ( M e a s u r e P a s s D e l e g a t e . k t : 4 2 2 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . r e m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 7 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . n o d e . M e a s u r e P a s s D e l e g a t e . m e a s u r e - B R T r y o 0 ( M e a s u r e P a s s D e l e g a t e . k t : 4 5 0 ) < b r   / >         a t   a n d r o i d x . c o m p o s e . u i . l a y o u t . R o o t M e a s u r e P o l i c y . m e a s u r e - 3 p 2 s 8 0 s(RootMeasurePolicy.kt:37)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:128)
at androidx.compose.ui.node.MeasurePassDelegate$performMeasureBlock$1.invoke(MeasurePassDelegate.kt:169)
at androidx.compose.ui.node.MeasurePassDelegate$performMeasureBlock$1.invoke(MeasurePassDelegate.kt:168)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2496)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:460)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:244)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:124)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:107)
at androidx.compose.ui.node.MeasurePassDelegate.performMeasure-BRTryo0$ui_release(MeasurePassDelegate.kt:422)
at androidx.compose.ui.node.MeasurePassDelegate.remeasure-BRTryo0(MeasurePassDelegate.kt:470)
at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1212)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:364)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:629)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:419)
at androidx.compose.ui.platform.AndroidComposeView.onMeasure_Original(AndroidComposeView.android.kt:1649)
at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:299)
at androidx.compose.ui.platform.AbstractComposeView.onMeasure_Original(ComposeView.android.kt:286)
at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure_Original(View.java:28192)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:28138)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:627)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureLayout(RenderSessionImpl.java:250)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:369)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:462)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:125)
at com.android.tools.rendering.RenderTask.createRenderSession(RenderTask.java:797)
at com.android.tools.rendering.RenderTask.lambda$inflate$7(RenderTask.java:945)
at com.android.tools.rendering.RenderExecutor.runAsyncActionWithTimeout$lambda$12(RenderExecutor.kt:210)
at com.android.tools.rendering.RenderExecutor$PriorityRunnable.run(RenderExecutor.kt:327)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by:  java.lang.ClassNotFoundException: androidx.emoji2.text.EmojiCompat
at com.android.tools.rendering.classloading.loaders.DelegatingClassLoader.loadClassBytes(DelegatingClassLoader.kt:62)
at com.android.tools.rendering.classloading.loaders.DelegatingClassLoader.findClass(DelegatingClassLoader.kt:84)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at com.android.tools.rendering.classloading.loaders.DelegatingClassLoader.loadClass(DelegatingClassLoader.kt:70)
... 134 more
Файлы Build.gradle.kts для приложения, и модуль показывает только следующие различия. alias (libs.plugins.androidkotlinmultiplatformlibrary) (у них оба есть три плагина, перечисленные выше, общего) (Нет ссылок на композицию или любые зависимости в любом блоке.) Реализация ("Androidx.customView: CustomView-PoolingContainer: 1.1.0") , но приложение, по-видимому, не нужно, чтобы это работало.>

Подробнее здесь: https://stackoverflow.com/questions/796 ... n-a-module
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»