在一个项目中无法解析com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0



我有2个项目,它们具有相同的gradle设置,关于mapbox一般,其中一个工作完全正常,另一个不工作,在构建时间内写入日志的错误是非常已知的:>无法找到com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0非常类似的问题即使在这里,我也无法解决错误,即使使用jcenter(),因为它在上面提到的问题中提到。在这两个项目中,我都以类似的方式使用jetpack compose。

代码片段(项目gradle):

maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MB_TOKEN'] ?: ""
}
}

模块gradle:

implementation("com.mapbox.mapboxsdk:mapbox-android-telemetry:7.0.0")
implementation('com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0')
implementation('com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0')
implementation("com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.8.0")
implementation("com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0")

完整构建消息:

Executing tasks: [:app:assembleDebug] in project /home/lzajicek/AndroidStudioProjects/loci
Starting Gradle Daemon...
Gradle Daemon started in 1 s 199 ms
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:generateDebugDatabaseInterface UP-TO-DATE
> Task :app:checkDebugAarMetadata FAILED
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugMainManifest FAILED
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets FAILED
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:checkDebugDuplicateClasses FAILED
> Task :app:desugarDebugFileDependencies FAILED
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:mergeDebugNativeLibs FAILED
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:writeDebugAppMetadata UP-TO-DATE
> Task :app:writeDebugSigningConfigVersions UP-TO-DATE
FAILURE: Build completed with 7 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 com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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:processDebugMainManifest'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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.
==============================================================================
5: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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.
==============================================================================
6: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:desugarDebugFileDependencies'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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.
==============================================================================
7: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app
> Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.8.0/mapbox-android-accounts-0.8.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 0s
18 actionable tasks: 7 executed, 11 up-to-date

同步gradle配置后的警告信息:

Failed to resolve: com.mapbox.mapboxsdk:mapbox-android-accounts:0.8.0
Show in Project Structure dialog
Affected Modules: app

有人知道转折在哪里吗?在这两个我都没有使用jcenter(),但我尝试了它在一个不工作,它也没有帮助。如有任何帮助,不胜感激

很可能您在错误的位置添加了jcenter()存储库。在Android Studio北极狐版本中,

allProjects {}

块被移动到settings.gradle您应该在这里添加jcenter()存储库。

这是如何新的设置。Gradle文件现在看起来像,

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "TinderLikeSwipeCardsJetpackCompose"
include ':app'