Моя самая большая трудность на данный момент заключается в том, что существует беспорядок учебных пособий и ссылок из различные версии функций kotlin/compose/android, которые очень сложно разобрать новичку.
My Entity
Код: Выделить всё
@Entity(tableName = "goals")
data class Goal(
@PrimaryKey(autoGenerate = true)
val id : Int = 0,
val text : String,
val date : String,
val complete : Boolean = false
)
Код: Выделить всё
@Dao
interface GoalDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(goal : Goal)
@Update
suspend fun update(goal : Goal)
@Delete
suspend fun delete(goal : Goal)
@Query("SELECT * FROM goals WHERE id = :id")
fun getGoal(id : Int) : Flow
@Query("SELECT * FROM goals ORDER BY date DESC")
fun getAllGoals() : Flow
}
Код: Выделить всё
@Database(
entities = [Goal::class],
version = 1,
exportSchema = false
)
abstract class GoalDatabase : RoomDatabase() {
abstract fun goalDao() : GoalDao
companion object {
@Volatile
private var Instance : GoalDatabase? = null
fun getDatabase(context : Context) : GoalDatabase {
return Instance ?: synchronized(this) {
Room.databaseBuilder(context, GoalDatabase::class.java, "goal_database")
.fallbackToDestructiveMigration()
.build()
.also { Instance = it }
}
}
}
}
Код: Выделить всё
class GoalRepository(private val goalDao : GoalDao) {
fun getAllGoals(): Flow = goalDao.getAllGoals()
@Suppress("RedundantSuspendModifier")
@WorkerThread
suspend fun insertGoal(goal : Goal) {
goalDao.insert(goal)
}
}
Код: Выделить всё
class GoalViewModel(private val repository: GoalRepository) : ViewModel() {
val allGoals : LiveData = repository.getAllGoals().asLiveData()
fun insert(goal : Goal) = viewModelScope.launch {
repository.insertGoal(goal)
}
}
class GoalViewModelFactory(private val repository: GoalRepository) : ViewModelProvider.Factory {
override fun create(modelClass : Class) : T {
if(modelClass.isAssignableFrom(GoalViewModel::class.java)) {
@Suppress("UNCHECKED_CAST")
return GoalViewModel(repository) as T
}
throw IllegalArgumentException("Unknown ViewModel class")
}
}
Код: Выделить всё
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val goalRepository = GoalRepository(GoalDatabase.getDatabase(application as Context).goalDao())
setContent {
PositiveTrackerTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
MainScreen(goalRepository)
}
}
}
}
}
@Composable
fun MainScreen(goalRepository: GoalRepository) {
val navController = rememberNavController()
NavHost(navController = navController, startDestination = "main") {
composable("main") {
Home(goalRepository)
}
}
}
@Composable
fun NewGoal(
onCompleteGoal: (String) -> Unit,
onCancelGoal: () -> Unit
) {
val focusRequester = remember { FocusRequester() }
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
Dialog(
onDismissRequest = {
onCancelGoal()
}
)
{
Card {
var goalText by remember { mutableStateOf("") }
Column(
modifier = Modifier.padding(16.dp)
) {
Text(
text = "New Goal",
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(bottom = 16.dp)
)
TextField(
value = goalText,
onValueChange = {
goalText = it
},
singleLine = true,
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
.focusRequester(focusRequester)
)
Row {
TextButton(
onClick = { onCancelGoal() },
modifier = Modifier.padding(8.dp)
) {
Text(text = "Cancel")
}
TextButton(
onClick = { onCompleteGoal(goalText) },
modifier = Modifier.padding(8.dp)
) {
Text(text = "Create Goal")
}
}
}
}
}
}
@Composable
fun GoalCard(goal : Goal) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.clip(shape = RoundedCornerShape(10.dp)),
colors = CardDefaults.cardColors()
) {
Column(
modifier = Modifier.fillMaxWidth()
) {
Text(
text = goal.text,
style = MaterialTheme.typography.affirmationQuote,
modifier = Modifier.padding(16.dp)
)
Text(
text = goal.date,
style = MaterialTheme.typography.labelSmall,
modifier = Modifier
.padding(16.dp)
.align(Alignment.End)
)
}
}
}
@Composable
fun Home(goalRepository : GoalRepository) {
var showNewGoal by remember { mutableStateOf(false) }
val coroutineScope = rememberCoroutineScope()
val viewModel : GoalViewModel = viewModel(factory = GoalViewModelFactory(goalRepository))
val goalList by viewModel.allGoals.observeAsState()
if(showNewGoal) {
NewGoal(
onCompleteGoal = {
showNewGoal = false
coroutineScope.launch {
goalRepository.insertGoal(
Goal(
text = it,
date = LocalDate.now().toString()
)
)
}
},
onCancelGoal = {
showNewGoal = false
}
)
}
Box(
modifier = Modifier.fillMaxSize()
)
{
Column(
modifier = Modifier.fillMaxSize()
) {
goalList!!.forEach {
GoalCard(it)
}
}
}
}
Код: Выделить всё
E FATAL EXCEPTION: main
Process: com.positivetracker, PID: 1 3 1 0 9 < b r / > j a v a . l a n g . N u l l P o i n t e r E x c e p t i o n < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y K t . H o m e ( M a i n A c t i v i t y . k t : 2 2 8 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y K t $ M a i n S c r e e n $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 9 2 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y K t $ M a i n S c r e e n $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 9 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 3 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t $ N a v H o s t $ 1 4 $ 1 . i n v o k e ( N a v H o s t . k t : 3 0 8 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t $ N a v H o s t $ 1 4 $ 1 . i n v o k e ( N a v H o s t . k t : 3 0 6 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 4 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 a v e a b l e . S a v e a b l e S t a t e H o l d e r I m p l . S a v e a b l e S t a t e P r o v i d e r ( S a v e a b l e S t a t e H o l d e r . k t : 8 4 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v B a c k S t a c k E n t r y P r o v i d e r K t . S a v e a b l e S t a t e P r o v i d e r ( N a v B a c k S t a c k E n t r y P r o v i d e r . k t : 6 5 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v B a c k S t a c k E n t r y P r o v i d e r K t . a c c e s s $ S a v e a b l e S t a t e P r o v i d e r ( N a v B a c k S t a c k E n t r y P r o v i d e r . k t : 1 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v B a c k S t a c k E n t r y P r o v i d e r K t $ L o c a l O w n e r s P r o v i d e r $ 1 . i n v o k e ( N a v B a c k S t a c k E n t r y P r o v i d e r . k t : 5 2 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v B a c k S t a c k E n t r y P r o v i d e r K t $ L o c a l O w n e r s P r o v i d e r $ 1 . i n v o k e ( N a v B a c k S t a c k E n t r y P r o v i d e r . k t : 5 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 2 8 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v B a c k S t a c k E n t r y P r o v i d e r K t . L o c a l O w n e r s P r o v i d e r ( N a v B a c k S t a c k E n t r y P r o v i d e r . k t : 4 7 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t $ N a v H o s t $ 1 4 . i n v o k e ( N a v H o s t . k t : 3 0 6 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t $ N a v H o s t $ 1 4 . i n v o k e ( N a v H o s t . k t : 2 9 5 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 3 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d C o n t e n t K t $ A n i m a t e d C o n t e n t $ 6 $ 1 $ 5 . i n v o k e ( A n i m a t e d C o n t e n t . k t : 7 5 5 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d C o n t e n t K t $ A n i m a t e d C o n t e n t $ 6 $ 1 $ 5 . i n v o k e ( A n i m a t e d C o n t e n t . k t : 7 4 4 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 1 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d V i s i b i l i t y K t . A n i m a t e d E n t e r E x i t I m p l ( A n i m a t e d V i s i b i l i t y . k t : 8 1 8 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d C o n t e n t K t $ A n i m a t e d C o n t e n t $ 6 $ 1 . i n v o k e ( A n i m a t e d C o n t e n t . k t : 7 2 6 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d C o n t e n t K t $ A n i m a t e d C o n t e n t $ 6 $ 1 . i n v o k e ( A n i m a t e d C o n t e n t . k t : 7 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < b r / > a t a n d r o i d x . c o m p o s e . a n i m a t i o n . A n i m a t e d C o n t e n t K t . A n i m a t e d C o n t e n t ( A n i m a t e d C o n t e n t . k t : 7 6 8 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t . N a v H o s t ( N a v H o s t . k t : 2 7 3 ) < b r / > a t a n d r o i d x . n a v i g a t i o n . c o m p o s e . N a v H o s t K t . N a v H o s t ( N a v H o s t . k t : 1 2 8 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y K t . M a i n S c r e e n ( M a i n A c t i v i t y . k t : 9 0 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 8 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 7 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 u r f a c e K t $ S u r f a c e $ 1 . i n v o k e ( S u r f a c e . k t : 1 3 4 ) < 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 u r f a c e K t $ S u r f a c e $ 1 . i n v o k e ( S u r f a c e . k t : 1 1 5 ) < b r / > E a t a n d r o i d x . c o m p o s e . r u n t i m e . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 2 8 ) < 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 u r f a c e K t . S u r f a c e - T 9 B R K 9 s ( S u r f a c e . k t : 1 1 2 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 4 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 2 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 4 8 ) < 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 . T e x t K t . P r o v i d e T e x t S t y l e ( T e x t . k t : 3 5 2 ) < 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 . M a t e r i a l T h e m e K t $ M a t e r i a l T h e m e $ 1 . i n v o k e ( M a t e r i a l T h e m e . k t : 7 2 ) < 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 . M a t e r i a l T h e m e K t $ M a t e r i a l T h e m e $ 1 . i n v o k e ( M a t e r i a l T h e m e . k t : 7 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 2 8 ) < 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 . M a t e r i a l T h e m e K t . M a t e r i a l T h e m e ( M a t e r i a l T h e m e . k t : 6 4 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . u i . t h e m e . T h e m e K t . P o s i t i v e T r a c k e r T h e m e ( T h e m e . k t : 8 7 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 2 ) < b r / > a t c o m . p o s i t i v e t r a c k e r . M a i n A c t i v i t y $ o n C r e a t e $ 1 . i n v o k e ( M a i n A c t i v i t y . k t : 7 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < b r / > a t a n d r o i d x . c o m p o s e . u i . p l a t f o r m . C o m p o s e V i e w . C o n t e n t ( C o m p o s e V i e w . a n d r o i d . k t : 4 2 8 ) < b r / > a t a n d r o i d x . c o m p o s e . u i . p l a t f o r m . A b s t r a c t C o m p o s e V i e w $ e n s u r e C o m p o s i t i o n C r e a t e d $ 1 . i n v o k e ( C o m p o s e V i e w . a n d r o i d . k t : 2 5 2 ) < b r / > a t a n d r o i d x . c o m p o s e . u i . p l a t f o r m . A b s t r a c t C o m p o s e V i e w $ e n s u r e C o m p o s i t i o n C r e a t e d $ 1 . i n v o k e ( C o m p o s e V i e w . a n d r o i d . k t : 2 5 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 1 0 9 ) < 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 . i n t e r n a l . C o m p o s a b l e L a m b d a I m p l . i n v o k e ( C o m p o s a b l e L a m b d a . j v m . k t : 3 5 ) < 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 . C o m p o s i t i o n L o c a l K t . C o m p o s i t i o n L o c a l P r o v i d e r ( C o m p o s i t i o n L o c a l . k t : 2 2 8 ) < b r / > a t a n d r o i d x . c o m p o s e . u i . p l a t f o r m . C o m p o s i t i o n L o c a l s K t . ProvideCommonCompositionLocals(CompositionLocals.kt:186)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:119)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:110)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:139)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:138)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:138)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:123)
E at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:90)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3302)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3235)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:725)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1071)
at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:633)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:619)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:123)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1289)
at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:114)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:164)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:322)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:199)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:121)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1364)
at android.view.View.dispatchAttachedToWindow(View.java:20479)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3489)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2417)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Подробнее здесь: https://stackoverflow.com/questions/783 ... rveasstate
Мобильная версия