Closed webdevineer closed 7 months ago
I'm also getting this same issue with the following error log : `FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all task dependencies for configuration ':rnmapbox_maps:debugCompileClasspath'. Could not find com.mapbox.maps:android:10.16.4. Required by: project :rnmapbox_maps Could not find com.mapbox.mapboxsdk:mapbox-sdk-turf:6.11.0. Required by: project :rnmapbox_maps`
This the react native map box version in package.json
:
"@rnmapbox/maps": "^10.0.15",
Would love to know what happened suddenly because previously It was working fine
@webdevineer you need to follow the setup guide:
See https://rnmapbox.github.io/docs/install?configure-module=android
@mfazekas is something new added in that documentation because previously it was fine
@mfazekas @webdevineer I have followed same steps and does not work for me. Not sure what is wrong here. Seems this configuration setup is not clear in document.
Error
`Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. Could not find com.mapbox.maps:android:10.1.16. Required by: project :app `
here is my build.gradle
`buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
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'] ?: ""
}
}
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("com.google.gms:google-services:4.4.0")
}
} `
My gradle.properties at user root folder
MAPBOX_DOWNLOADS_TOKEN=sk.ey*******************
and added dependancies at app/build.gradle
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.mapbox.maps:android:10.1.16")
.....
}
@mfazekas @webdevineer I have followed same steps and does not work for me. Not sure what is wrong here. Seems this configuration setup is not clear in document.
Error
`Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. Could not find com.mapbox.maps:android:10.1.16. Required by: project :app `
here is my build.gradle
`buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "23.1.7779620" } repositories { google() mavenCentral() 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'] ?: "" } } } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("com.google.gms:google-services:4.4.0") }
} `
My gradle.properties at user root folder
MAPBOX_DOWNLOADS_TOKEN=sk.ey*******************
and added dependancies at app/build.gradle
dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation("com.mapbox.maps:android:10.1.16") ..... }
I solved the issue on mine by moving the credentials from buildscript {}
to allprojects {}
as follows:
buildscript {
}
allprojects {
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
...
}
}
}
}
Also, you might try using you mapbox secret key directly, if you encounter same issue again
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 = "SECRET-TOKEN-HERE"
}
@ndpiparava I did this change in android/build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath('com.google.gms:google-services:4.4.0')
}
}
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'] ?: "YOUR_SECRET_TOKEN"
}
}
}
}
Copy paste this might help
This page https://docs.mapbox.com/help/glossary/maps-sdk-for-react-native/ points to https://github.com/rnmapbox/maps/blob/main/docs/GettingStarted.md which makes no mention of these extra steps.
Can we please get the docs updated to include these steps.
Yeah sure why not @CyberCyclone could you guide me how can I do that ?
Hey guys this saved my day 💯 + official docs it completes your solution @Alreadywinner
https://github.com/rnmapbox/maps/blob/main/android/install.md
Hey guys this saved my day 💯 it completes your solution @Alreadywinner
https://github.com/rnmapbox/maps/blob/main/example/android/build.gradle
Thanks for appreciation.
Error
Build Error
Environment
Steps to reproduce