有人知道如何调试这个吗?我无法弄清楚哪些库产生了问题。
旁注,它只发生在我尝试运行 Android 测试时,所以我最好的猜测是它与某些测试库有关。
testImplementation "androidx.room:room-testing:$version_room"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
// Compose Tests
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$version_compose"
debugImplementation "androidx.compose.ui:ui-test-manifest:$version_compose"
// Hilt test
androidTestImplementation "com.google.dagger:hilt-android-testing:$version_hilt"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$version_hilt"
debugImplementation 'androidx.fragment:fragment-testing:1.3.6'
Run Code Online (Sandbox Code Playgroud)
Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'META-INF/LGPL2.1' from inputs:
- /home/lbenevento/.gradle/caches/transforms-3/1e2dfa6057fe4e701d175f47b1099efa/transformed/jetified-jna-platform-5.5.0.jar
- /home/lbenevento/.gradle/caches/transforms-3/405542266c1c406c39ff1a20cb26a332/transformed/jetified-jna-5.5.0.jar
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information
* Try:
Run with --info or --debug option to get more log …
Run Code Online (Sandbox Code Playgroud) 我在回收器视图中的某些动画时遇到问题。我在onViewAttachedToWindow中做了相关测量:
override fun onViewAttachedToWindow(holder: PairingViewHolder) {
super.onViewAttachedToWindow(holder)
// get originalHeight & expandedHeight if not gotten before
if (holder.expandedHeight < 0) {
// Execute pending bindings, otherwise the measurement will be wrong.
holder.itemViewDataBinding.executePendingBindings()
holder.cardContainer.layoutParams.width = expandedWidth
holder.expandedHeight = 0 // so that this block is only called once
holder.cardContainer.doOnLayout { view ->
holder.originalHeight = view.height
holder.expandView.isVisible = true
// show expandView and record expandedHeight in next layout pass
// (doOnPreDraw) and hide it immediately.
view.doOnPreDraw {
holder.expandedHeight = view.height
holder.expandView.isVisible = …
Run Code Online (Sandbox Code Playgroud) 我有一个用于动态定义菜单的数据类。
data class ActionItemSpec(
val contentDescription: String,
val icon: ImageVector,
val onClick: () -> Unit
)
Run Code Online (Sandbox Code Playgroud)
我的问题是,当使用标准图标时,它可以完美地工作,但此类问题是它不能采用其他任何东西,例如自定义可绘制对象。
如何从自定义可绘制对象创建 ImageVector?你可以撰写吗?