maps: RN 0.66 Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0

Describe the bug
After upgrading React Native from 0.63.4 to 0.66 android project does not compile, showing the error:

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.7.0.
     Required by:
         project :app > project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0

Versions (please complete the following information):

  • Platform: Android
  • Dev OS: macOS 11.6
  • react-native-mapbox-gl Version 8.3.0
  • React Native Version 0.66

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (3 by maintainers)

Most upvoted comments

can you please try with:

android/build.gradle

repositories {
    // ...
    jcenter()
}

notice, that this is probably just a temporary workaround as jcenter as a dep repo is no longer maintained indefinitely (some time 2022 I believe). I couldn’t get it to work with mavenCentral unfortunately, although I believe, that mapbox did move their deps there 😕

As @ryanjwessel said, you can get rid of the deprecated jcenter() with a mapbox repo.

This is a step by step guide:

  1. Authorize here: https://account.mapbox.com/access-tokens/create/
  2. Check the box “DOWNLOADS:READ” and create a new token.
  3. Insert into android/gradle.properties your token: MAPBOX_DOWNLOADS_TOKEN=<here>
  4. Replace “jcenter()” with “mavenCentral()” in android/build.gradle and put the code under allprojects -> repositories:
	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['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
            }
       }

Doesn’t matter if you had maven records before. This should work.

We spent the majority of the morning trying to fix this issue. Seems the conclusion was that jcenter was down and now it is back up. We are using React-Native 0.64.1, because some dependencies have not yet updated, and jcenter was still kept on as read only.

jcenter.bintray.com is consistently returning error codes today. Because of that, we are removing jcenter from build.gradle to unblock Android builds locally. Doing so results in the error mentioned in this Issue’s original description.

> Could not resolve all files for configuration ':app:dataminrStagingDebugRuntimeClasspath'.
   > Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://www.jitpack.io/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
     Required by:
         project :app > project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0

Despite the fact that Jfrog says it will maintain it as read-only indefinitely, my team has seen issues where Jcenter + Bintray are unavailable which blocks any new Android builds.

It would be beneficial to move these dependencies to an actively-maintained dependency repository, like mavenCentral, to avoid the potential pain caused by jcenter’s reliability diminishing over time.

Is there any update soon to make this library work without jcenter() ?

nah, not in the works atm - feel free to open a PR though.

Also jcenter not gonna shut down anymore, so that’s that 🤷🏿

I confirm, it’s the only way to build right now getting rid of jcenter dependencies. Thanks mate!

PS. Be aware to follow the process of issuing a download token, and everything should be fine!

The Getting Started docs for Android does explain how to use mavenCentral over jCenter for this dependency. It does require more setup to provide the secret access token but should resolve this issue. I have not tried this yet, but it seems like it should work.