我的Android Studio项目无法构建,因为我无法理解的错误。它说,它无法找到数据存储依赖项,即使它们在那里。如果有人知道什么是错的,我很乐意知道。先谢谢你了!
Executing tasks: [:app:generateDebugSources, :app:compileDebugSources] in project C
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:compileLintChecks UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:checkDebugAarMetadata FAILED
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:mapDebugSourceSetPaths FAILED
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED
> Task :app:packageDebugResources UP-TO-DATE
> Task :app:parseDebugLocalResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugMainManifest FAILED
> Task :app:javaPreCompileDebug UP-TO-DATE
FAILURE: Build completed with 4 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mapDebugSourceSetPaths'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
> Could not find androidx.datastore:datastore-preferences-android:1.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
- https://repo.maven.apache.org/maven2/androidx/datastore/datastore-preferences-android/1.1.0/datastore-preferences-android-1.1.0.pom
Required by:
project :app
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 910ms
11 actionable tasks: 4 executed, 7 up-to-date
这是我的gradle文件。我将数据存储所需的依赖项放入工作中,但没有成功。
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.littlelemon'
compileSdk 33
defaultConfig {
applicationId "com.example.littlelemon"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.1.1'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.navigation:navigation-compose:2.5.3'
implementation "androidx.compose.ui:ui-tooling:1.3.3"
implementation 'androidx.datastore:datastore-preferences:1.0.0'
implementation "androidx.datastore:datastore-preferences-android:1.1.0-alpha04"
implementation "androidx.datastore:datastore-preferences-android:1.1.0"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation 'androidx.compose.material:material:1.1.1'
implementation 'androidx.datastore:datastore-core-android:1.1.0-alpha04'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha02"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-alpha02"
}
1条答案
按热度按时间7fhtutme1#
这是因为
androidx.datastore:datastore-*
的稳定版本1.1还不存在--只有alpha版本可用。由于您对alpha版本感兴趣,因此需要删除app
build.gradle
文件中不正确的依赖: