英文:
AnimatedContentTransitionScope is unresolved when i run the compileReleaseKotlin gradle task
问题
I'm building an Android application using Jetpack Compose 1.5.0-alpha02
and utilizing the animated content composable as below:
import androidx.compose.animation.AnimatedContent
import androidx.compose.runtime.*
//...
var progress by remember { mutableStateOf(1) }
AnimatedContent(
targetState = progress,
modifier = Modifier.fillMaxWidth(),
transitionSpec = {
slideInOutLeft()
}
) {
// my other composables
}
I extracted the slideInOut()
function to a file called "transitions" so that I can reuse it in multiple places, but this is its implementation:
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.tween
import androidx.compose.animation.with
inline fun <reified T> AnimatedContentTransitionScope<T>.slideInOutLeft(): ContentTransform
= slideIntoContainer(
animationSpec = tween(300, easing = EaseInOut),
towards = AnimatedContentTransitionScope.SlideDirection.Left
).with(
slideOutOfContainer(
animationSpec = tween(300, easing = EaseInOut),
towards = AnimatedContentTransitionScope.SlideDirection.Left
)
)
When I run and build the app on an emulator or physical device, I get no errors. However, when I try to push it to GitHub, the gradle compileReleaseKotlin
Gradle task fails, and this is the error I'm getting:
Unresolved reference: AnimatedContentTransitionScope
I've tried upgrading dependencies, downgrading them, reading the documentation, searching the internet, but I couldn't find a solution. Any help would be highly appreciated as I don't know what's wrong.
英文:
Im building an android application using Jetpack Compose 1.5.0-alpha02
and utilizing the animated content composable as below
import androidx.compose.animation.AnimatedContent
import androidx.compose.runtime.*
//...
var progress by remember { mutableStateOf(1) }
AnimatedContent(
targetState = progress,
modifier = Modifier.fillMaxWidth(),
transitionSpec = {
slideInOutLeft()
}
) {
// my other composables
}
I extracted the slideInOut()
function to a file called transitions so that i can reuse it in multiple places but this is its implementations
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.tween
import androidx.compose.animation.with
inline fun <reified T> AnimatedContentTransitionScope<T>.slideInOutLeft(): ContentTransform
= slideIntoContainer(
animationSpec = tween(300, easing = EaseInOut),
towards = AnimatedContentTransitionScope.SlideDirection.Left
).with(
slideOutOfContainer(
animationSpec = tween(300, easing = EaseInOut),
towards = AnimatedContentTransitionScope.SlideDirection.Left
)
)
When i run and build the app on an emulator or physical device i get no errors but when i try to push it to github, the gradle compileReleaseKotlin
gradle task was failing. and this is the error I'm getting
Unresolved reference: AnimatedContentTransitionScope
Ive tried upgrading dependencies, downgrading them reading the documentation searching the internet using gpt4 but no results. Please any help will be highly appreciated as i dont know whats wrong
答案1
得分: 1
更新伴奏导航动画依赖项至 0.31.5-beta
implementation "com.google.accompanist:accompanist-navigation-animation:0.31.5-beta"
英文:
update accompanist navigation animation dependencies to 0.31.5-beta
implementation "com.google.accompanist:accompanist-navigation-animation:0.31.5-beta"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论