android - 无法在一个项目中解析 com.mapbox.mapboxsdk :mapbox-android-accounts:0. 7.0,但在另一个项目中可以吗?

标签 android kotlin mapbox-android

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

代码 fragment (项目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'] ?: ""
            }
        }

模块等级:

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()

存储库。但是加上jcenter()后就正常了。

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

allProjects {}

block 已移至 settings.gradle 文件,您应该在此处添加 jcenter() 存储库。

这是新的 settings.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'

关于android - 无法在一个项目中解析 com.mapbox.mapboxsdk :mapbox-android-accounts:0. 7.0,但在另一个项目中可以吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69618898/

相关文章:

android - Gradle 混合版本 27.1.1 和 26.1.0

java - 使用 Rx 填充具有额外响应的模型

android - 在某些 fragment 中隐藏抽屉导航

java - Mapbox Android 中空对象引用上的 NavigationView

android - 如何从 Android 中的经纬度列表创建 Mapbox 热点和热图?

android - Android中应用程序的内存(CPU)使用情况

android - 将 Android ScrollView 滚动到 X 轴和 Y 轴

android - BottomSheetDialogFragment未打开,仅显示小白条

android - 如何在android中的MAPBOX中获取当前位置

java - 如何在 Activity 退出之前释放分配给可绘制对象的内存?