Я используюnchoredDraggable в своем проекте для реализации управления перелистыванием в Compose. Я использую Compose BOM 2024.09.00 в своем проекте.
Теперь, когда я создаю проект, он собирается хорошо и запускает приложение из студии Android. Но когда я создаю подписанный APK, он терпит неудачу и выдает мне ошибку. Неразрешенная ссылка «AnchoredDraggableDefaults. Почему?
Я использую это в коде как
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun someFunction() {
val swipeState =
remember {
AnchoredDraggableState(
initialValue = false,
anchors =
DraggableAnchors {
false at 0f
true at endPx
},
)
}
Box(
modifier =
Modifier
.offset {
// Safety check to ensure offset is read only after layout/initialization
val offset =
try {
swipeState.requireOffset()
} catch (e: Exception) {
0f
}
IntOffset(offset.roundToInt(), 0)
}.size(handleSize)
.padding(4.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary)
.anchoredDraggable(
state = swipeState,
orientation = Orientation.Horizontal,
flingBehavior = flingBehavior,
),
contentAlignment = Alignment.Center,
) {
// some code
}
val flingBehavior =
AnchoredDraggableDefaults.flingBehavior(
state = swipeState,
positionalThreshold = { distance -> distance * 0.5f },
animationSpec =
spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow,
),
)
}
Почему в режиме отладки все работает нормально, но при создании подписанного APK происходит сбой
Я попробовал в новом новом проекте. Здесь тоже не получается. Ниже приведены файлы
build.gradle.kts уровня проекта
.// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
}
Уровень приложения build.gradle.kts
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
android {
namespace = "com.yegoglobal.testswipe"
compileSdk {
version = release(36)
}
defaultConfig {
applicationId = "com.yegoglobal.testswipe"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
buildFeatures {
compose = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation(platform("androidx.compose:compose-bom:2024.09.00"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
}
Файл Kotlin
package com.yegoglobal.testswipe
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.AnchoredDraggableDefaults
import androidx.compose.foundation.gestures.AnchoredDraggableState
import androidx.compose.foundation.gestures.DraggableAnchors
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.anchoredDraggable
import androidx.compose.foundation.gestures.animateTo
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import kotlin.math.roundToInt
@Composable
fun SwipeToArrived(
modifier: Modifier = Modifier,
onArrived: () -> Unit,
isLoading: Boolean = false,
shouldReset: Boolean,
onResetHandled: () -> Unit
) {
val density = LocalDensity.current
val handleSize = 56.dp
val handleSizePx = with(density) { handleSize.toPx() }
// Use BoxWithConstraints to calculate the dynamic width of the component
BoxWithConstraints(
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 16.dp) // Requirement: Full width with padding
.height(handleSize)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.surfaceContainerHighest),
contentAlignment = Alignment.CenterStart
) {
val maxWidthPx = constraints.maxWidth.toFloat()
val endPx = maxWidthPx - handleSizePx
val swipeState = remember {
AnchoredDraggableState(
initialValue = false,
anchors = DraggableAnchors {
false at 0f
true at endPx
}
)
}
LaunchedEffect(shouldReset) {
if (shouldReset) {
swipeState.animateTo(false)
onResetHandled()
}
}
// Trigger action when the state becomes 'true' (Arrived)
LaunchedEffect(swipeState.settledValue) {
if (swipeState.settledValue) {
onArrived()
}
}
val flingBehavior = AnchoredDraggableDefaults.flingBehavior(
state = swipeState,
positionalThreshold = { distance -> distance * 0.5f },
animationSpec = spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow
)
)
// Arrow Nudge Animation logic
val infiniteTransition = rememberInfiniteTransition(label = "arrowNudge")
val nudgeOffset by infiniteTransition.animateFloat(
initialValue = 0f,
targetValue = 8f,
animationSpec = infiniteRepeatable(
animation = tween(500, easing = LinearEasing),
repeatMode = RepeatMode.Reverse
),
label = "nudge"
)
// Track Text - Stays static in the center
Text(
text = "Swipe to Arrive",
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
// The Draggable Handle
Box(
modifier = Modifier
.offset {
// Safety check to ensure offset is read only after layout/initialization
val offset = try {
swipeState.requireOffset()
} catch (e: Exception) {
0f
}
IntOffset(offset.roundToInt(), 0)
}
.size(handleSize)
.padding(4.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary)
.anchoredDraggable(
state = swipeState,
orientation = Orientation.Horizontal,
flingBehavior = flingBehavior,
),
contentAlignment = Alignment.Center
) {
if (isLoading) {
CircularProgressIndicator(
modifier = Modifier.size(24.dp),
color = MaterialTheme.colorScheme.onPrimary,
strokeWidth = 2.dp
)
} else {
Icon(
imageVector = Icons.Default.Delete,
contentDescription = null,
tint = MaterialTheme.colorScheme.onPrimary,
modifier = Modifier.offset(x = nudgeOffset.dp)
)
}
}
}
}
libs.version.toml
[versions]
agp = "8.13.2"
kotlin = "2.0.21"
coreKtx = "1.17.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.7.1"
material = "1.13.0"
lifecycleRuntimeKtx = "2.10.0"
activityCompose = "1.12.2"
composeBom = "2024.09.00"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Ниже приведена ошибка сборки
> Task :app:compileReleaseKotlin FAILED
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:12:45 Unresolved reference 'AnchoredDraggableDefaults'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:70:26 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:70:35 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:71:13 None of the following candidates is applicable:
constructor(initialValue: T, anchors: DraggableAnchors, positionalThreshold: (@ParameterName(...) Float) -> Float, velocityThreshold: () -> Float, snapAnimationSpec: AnimationSpec, decayAnimationSpec: DecayAnimationSpec, confirmValueChange: (@ParameterName(...) T) -> Boolean = ...): AnchoredDraggableState
constructor(initialValue: T, positionalThreshold: (@ParameterName(...) Float) -> Float, velocityThreshold: () -> Float, snapAnimationSpec: AnimationSpec, decayAnimationSpec: DecayAnimationSpec, confirmValueChange: (@ParameterName(...) T) -> Boolean = ...): AnchoredDraggableState
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:73:27 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:74:27 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:75:26 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:82:28 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:89:35 Unresolved reference 'settledValue'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:90:28 Unresolved reference 'settledValue'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:95:29 Unresolved reference 'AnchoredDraggableDefaults'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:97:37 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:97:58 None of the following candidates is applicable:
fun BigDecimal.times(other: BigDecimal): BigDecimal
fun BigInteger.times(other: BigInteger): BigInteger
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:98:29 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:131:36 Unresolved reference 'requireOffset'.
Подробнее здесь: https://stackoverflow.com/questions/798 ... ease-build
Неразрешенная ссылка «AnchoredDraggableDefaults при создании сборки выпуска» ⇐ Android
Форум для тех, кто программирует под Android
1768470160
Anonymous
Я используюnchoredDraggable в своем проекте для реализации управления перелистыванием в Compose. Я использую Compose BOM 2024.09.00 в своем проекте.
Теперь, когда я создаю проект, он собирается хорошо и запускает приложение из студии Android. Но когда я создаю подписанный APK, он терпит неудачу и выдает мне ошибку. Неразрешенная ссылка «AnchoredDraggableDefaults. Почему?
Я использую это в коде как
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun someFunction() {
val swipeState =
remember {
AnchoredDraggableState(
initialValue = false,
anchors =
DraggableAnchors {
false at 0f
true at endPx
},
)
}
Box(
modifier =
Modifier
.offset {
// Safety check to ensure offset is read only after layout/initialization
val offset =
try {
swipeState.requireOffset()
} catch (e: Exception) {
0f
}
IntOffset(offset.roundToInt(), 0)
}.size(handleSize)
.padding(4.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary)
.anchoredDraggable(
state = swipeState,
orientation = Orientation.Horizontal,
flingBehavior = flingBehavior,
),
contentAlignment = Alignment.Center,
) {
// some code
}
val flingBehavior =
AnchoredDraggableDefaults.flingBehavior(
state = swipeState,
positionalThreshold = { distance -> distance * 0.5f },
animationSpec =
spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow,
),
)
}
Почему в режиме отладки все работает нормально, но при создании подписанного APK происходит сбой
[b]Я попробовал в новом новом проекте. Здесь тоже не получается. Ниже приведены файлы[/b]
[b]build.gradle.kts уровня проекта[/b]
.// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
}
[b]Уровень приложения build.gradle.kts[/b]
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
android {
namespace = "com.yegoglobal.testswipe"
compileSdk {
version = release(36)
}
defaultConfig {
applicationId = "com.yegoglobal.testswipe"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
buildFeatures {
compose = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation(platform("androidx.compose:compose-bom:2024.09.00"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
}
[b]Файл Kotlin[/b]
package com.yegoglobal.testswipe
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.AnchoredDraggableDefaults
import androidx.compose.foundation.gestures.AnchoredDraggableState
import androidx.compose.foundation.gestures.DraggableAnchors
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.anchoredDraggable
import androidx.compose.foundation.gestures.animateTo
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import kotlin.math.roundToInt
@Composable
fun SwipeToArrived(
modifier: Modifier = Modifier,
onArrived: () -> Unit,
isLoading: Boolean = false,
shouldReset: Boolean,
onResetHandled: () -> Unit
) {
val density = LocalDensity.current
val handleSize = 56.dp
val handleSizePx = with(density) { handleSize.toPx() }
// Use BoxWithConstraints to calculate the dynamic width of the component
BoxWithConstraints(
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 16.dp) // Requirement: Full width with padding
.height(handleSize)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.surfaceContainerHighest),
contentAlignment = Alignment.CenterStart
) {
val maxWidthPx = constraints.maxWidth.toFloat()
val endPx = maxWidthPx - handleSizePx
val swipeState = remember {
AnchoredDraggableState(
initialValue = false,
anchors = DraggableAnchors {
false at 0f
true at endPx
}
)
}
LaunchedEffect(shouldReset) {
if (shouldReset) {
swipeState.animateTo(false)
onResetHandled()
}
}
// Trigger action when the state becomes 'true' (Arrived)
LaunchedEffect(swipeState.settledValue) {
if (swipeState.settledValue) {
onArrived()
}
}
val flingBehavior = AnchoredDraggableDefaults.flingBehavior(
state = swipeState,
positionalThreshold = { distance -> distance * 0.5f },
animationSpec = spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow
)
)
// Arrow Nudge Animation logic
val infiniteTransition = rememberInfiniteTransition(label = "arrowNudge")
val nudgeOffset by infiniteTransition.animateFloat(
initialValue = 0f,
targetValue = 8f,
animationSpec = infiniteRepeatable(
animation = tween(500, easing = LinearEasing),
repeatMode = RepeatMode.Reverse
),
label = "nudge"
)
// Track Text - Stays static in the center
Text(
text = "Swipe to Arrive",
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
// The Draggable Handle
Box(
modifier = Modifier
.offset {
// Safety check to ensure offset is read only after layout/initialization
val offset = try {
swipeState.requireOffset()
} catch (e: Exception) {
0f
}
IntOffset(offset.roundToInt(), 0)
}
.size(handleSize)
.padding(4.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary)
.anchoredDraggable(
state = swipeState,
orientation = Orientation.Horizontal,
flingBehavior = flingBehavior,
),
contentAlignment = Alignment.Center
) {
if (isLoading) {
CircularProgressIndicator(
modifier = Modifier.size(24.dp),
color = MaterialTheme.colorScheme.onPrimary,
strokeWidth = 2.dp
)
} else {
Icon(
imageVector = Icons.Default.Delete,
contentDescription = null,
tint = MaterialTheme.colorScheme.onPrimary,
modifier = Modifier.offset(x = nudgeOffset.dp)
)
}
}
}
}
[b]libs.version.toml[/b]
[versions]
agp = "8.13.2"
kotlin = "2.0.21"
coreKtx = "1.17.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.7.1"
material = "1.13.0"
lifecycleRuntimeKtx = "2.10.0"
activityCompose = "1.12.2"
composeBom = "2024.09.00"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Ниже приведена ошибка сборки
> Task :app:compileReleaseKotlin FAILED
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:12:45 Unresolved reference 'AnchoredDraggableDefaults'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:70:26 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:70:35 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:71:13 None of the following candidates is applicable:
constructor(initialValue: T, anchors: DraggableAnchors, positionalThreshold: (@ParameterName(...) Float) -> Float, velocityThreshold: () -> Float, snapAnimationSpec: AnimationSpec, decayAnimationSpec: DecayAnimationSpec, confirmValueChange: (@ParameterName(...) T) -> Boolean = ...): AnchoredDraggableState
constructor(initialValue: T, positionalThreshold: (@ParameterName(...) Float) -> Float, velocityThreshold: () -> Float, snapAnimationSpec: AnimationSpec, decayAnimationSpec: DecayAnimationSpec, confirmValueChange: (@ParameterName(...) T) -> Boolean = ...): AnchoredDraggableState
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:73:27 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:74:27 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:75:26 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:82:28 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:89:35 Unresolved reference 'settledValue'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:90:28 Unresolved reference 'settledValue'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:95:29 Unresolved reference 'AnchoredDraggableDefaults'.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:97:37 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:97:58 None of the following candidates is applicable:
fun BigDecimal.times(other: BigDecimal): BigDecimal
fun BigInteger.times(other: BigInteger): BigInteger
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:98:29 Cannot infer type for this parameter. Please specify it explicitly.
e: file:///D:/Projects/Android_Projects/Temp/app/src/main/java/com/yegoglobal/testswipe/MyFile.kt:131:36 Unresolved reference 'requireOffset'.
Подробнее здесь: [url]https://stackoverflow.com/questions/79868254/unresolved-reference-anchoreddraggabledefaults-when-generating-release-build[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия