question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React-native Android build fails with: Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1.

See original GitHub issue

Describe the bug

I have a very basic react-native app that builds and runs perfectly in iOS. When I build it in Android Studio, the result is:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1.
     Required by:
         project :app > project :react-native-mapbox-gl_maps
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.7.1/mapbox-android-sdk-9.7.1.pom'.
            > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.7.1/mapbox-android-sdk-9.7.1.pom'. Received status code 403 from server: Forbidden
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0.
     Required by:
         project :app > project :react-native-mapbox-gl_maps
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-plugin-localization-v9/0.14.0/mapbox-android-plugin-localization-v9-0.14.0.pom'.
            > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-plugin-localization-v9/0.14.0/mapbox-android-plugin-localization-v9-0.14.0.pom'. Received status code 403 from server: Forbidden
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1.
     Required by:
         project :app > project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0
         project :app > project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.7.1/mapbox-android-sdk-9.7.1.pom'.
            > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.7.1/mapbox-android-sdk-9.7.1.pom'. Received status code 403 from server: Forbidden

The build.gradle file is:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
        rnmbglMapboxLibs = {
            implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1'
            implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0'
            implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.8.0'
            implementation 'com.mapbox.mapboxsdk:mapbox-android-gestures:0.7.0'
        }

        rnmbglMapboxPlugins = {
            implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0'
            implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0'
            implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
        }
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
        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 = 'token removed'
            }
        }
    }
}

Versions (please complete the following information):

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Arnaodcommented, Feb 10, 2022

Anyone succeded in building an app on Android with MapBox ? We’ve been stuck on this issue for a few weeks, seems odd to me that it can’t be built.

1reaction
codydaigcommented, Jan 22, 2022

I think I am having similar issues where I can’t get dependencies from bintray. The build consistently fails and has failed for the past month for me all related to bintray. I haven’t tried the example directly as that won’t do me much good. I have used the build.gradle with no luck. It’s trying to pull in dependencies from bintray and bintray is unaccessible for me and has been for a while. Any advice?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-native Android build fails with: Could not resolve com ...
Describe the bug I have a very basic react-native app that builds and runs perfectly in iOS. When I build it in Android...
Read more >
react-native Android Mapbox build problem - Stack Overflow
I have looked at the post mentioned in the comment, and it does not resolve my problem. Any help would be much appreciated....
Read more >
Maps SDK for React Native | Help - Mapbox
The Maps SDK for React Native is a community-managed React Native library for integrating Mapbox maps into mobile apps.
Read more >
@react-native-mapbox-gl/maps - npm
A Mapbox GL react native module for creating custom maps. Latest version: 8.6.0-beta.0, last published: 9 months ago.
Read more >
rnmapbox/Lobby - Gitter
Could not resolve all files for configuration ... to @react-native-mapbox-gl/maps/android/rctmgl/build.gradle as recommended.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found