Android

スポンサーリンク
Android

【Kotlin】init内での非同期処理ミスケース

①init内で発火するCoroutineでasyncして、他のsuspend関数でawaitする場合の実装ミス タイミング問題で表面化しない可能性があるので厄介です。 initはsuspend関数ではないため、coroutin...
Android

SharedFlow(StateFlow)かObserverパターンか

SharedFlow, StateFlowの違いについて StateFlowはSharedFlowの特殊版。 初期値を有する新しいSubscriberには最新の値をemit最新値以外のCacheはしないresetReplayC...
Android

Module with the Main dispatcher had failed to initialize. For tests Dispatchers.setMain from kotlinx-coroutines-test module can be used

原因 Main Threadでの実行が必要なAPIを使用している。 対策 公式の回答がこちら DispatcherをMainに置き換える 基本的にこちらの方法で問題ありません。ベストプラクティスで...
Android

Method parse in android.net.Uri not mocked【Kotlin】【Unit Test】【Android】

UriがMockされていない UnitTestでAndroid frameworkとして定義されているUriをそのまま用いると上記のようなErrorを発報します。構成はKotlin + JUnit5 + Androidです。 ...
Android

【Jetpack Compose】Listの変更をRecompose起点にする

mutableStateListOf ListをStateとしてComposeのrecompose起点としたい場合にはmutableStateListOf()関数を用いてListを作成すればよい。 viewmodel層に作成し...
Android

java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.

タイトルのエラーはLazyColumnやColumn(Modifier.verticalScroll())等がネストしている時に発生します。 2つネストすると確かにスクロール入力がどちらになるか分からないし、高さが決められないですね...
Android

Given component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt.internal.GeneratedComponent or interface dagger.hilt.internal.GeneratedComponentManager

Jetpack Compose + Hiltでテストしている人に向けて Jetpack Composeで予めInstrumentation Testを一度実施したことがあって、Hiltを使ったアプリケーションを初めて動かすときにはま...
Android

{classname} declares multiple JSON fields named gson {fieldname}

エラー内容 GsonをKotlinで取り扱う際に、親クラスのfieldを使用するときに発生するエラーです。原因は完全には理解できていませんが、Kotlinはpropertyをbacking fieldとして実現することが悪さをしてい...
Android

Objectに追加されたextention propertyをreflectionで取得したい

何を言っているか分からないかもしれませんが、やりたかったことはMaterial Designとして提供されているSync, Accessible等のImageVectorを名前で指定してインスタンスを取得したかったのです。(Materia...
Android

Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setUseSessionTickets(Z)V (light greylist, reflection)

原因 non-SDK interfaceにアクセスした場合に発生します。 non-SDK interfaceとはAndroidが公式なInterfaceとして公開していないpackageメソッドやprivateメソ...
スポンサーリンク
タイトルとURLをコピーしました