rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.23k stars 839 forks source link

Could not find com.mapbox.maps:android:10.16.4. #3381

Closed webdevineer closed 7 months ago

webdevineer commented 7 months ago

Error

Could not find com.mapbox.maps:android:10.16.4. Searched in the following locations: -https://oss.sonatype.org/content/repositories/snapshots/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - https://repo.maven.apache.org/maven2/com/mapbox/maps/android/10.16.4/android-10.16.4.pom

THIS LINK DOES NOT EXIST: https://oss.sonatype.org/content/repositories/snapshots/com/mapbox/maps...

Build Error

BUILD FAILED in 7m 12s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:processDebugResources'. > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not find com.mapbox.maps:android:10.16.4. Searched in the following locations: -https://oss.sonatype.org/content/repositories/snapshots/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - https://repo.maven.apache.org/maven2/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - file:/C:/Users/HP/Desktop/app/rogoods/node_modules/jsc-android/dist/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - https://dl.google.com/dl/android/maven2/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - https://www.jitpack.io/com/mapbox/maps/android/10.16.4/android-10.16.4.pom - https://maven.regulaforensics.com/RegulaDocumentReader/com/mapbox/maps/android/10.16.4/android-10.16.4.pom Required by: project :app > project :rnmapbox_maps > Could not find com.mapbox.mapboxsdk:mapbox-sdk-turf:6.11.0. Searched in the following locations: - https://oss.sonatype.org/content/repositories/snapshots/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom - https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom - file:/C:/Users/HP/Desktop/app/rogoods/node_modules/jsc-android/dist/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom - https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom - https://www.jitpack.io/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom 
- https://maven.regulaforensics.com/RegulaDocumentReader/com/mapbox/mapboxsdk/mapbox-sdk-turf/6.11.0/mapbox-sdk-turf-6.11.0.pom Required by: project :app > project :rnmapbox_maps * 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. BUILD FAILED in 7m 12s.   info Run CLI with --verbose flag for more details.

Environment

Steps to reproduce

react-native init sample --version react-native@0.73.2
cd sample
`npm install @rnmapbox/maps@10.1.13 --save`
react-native run-android
Alreadywinner commented 7 months ago

I'm also getting this same issue with the following error log : `FAILURE: Build failed with an exception.

mfazekas commented 7 months ago

@webdevineer you need to follow the setup guide:

See https://rnmapbox.github.io/docs/install?configure-module=android

Alreadywinner commented 7 months ago

@mfazekas is something new added in that documentation because previously it was fine

ndpiparava commented 7 months ago

@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")
    .....
    }
webdevineer commented 7 months ago

@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"
            }
Alreadywinner commented 7 months ago

@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

CyberCyclone commented 5 months ago

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.

Alreadywinner commented 5 months ago

Yeah sure why not @CyberCyclone could you guide me how can I do that ?

shiraz27 commented 5 months ago

Hey guys this saved my day 💯 + official docs it completes your solution @Alreadywinner

https://github.com/rnmapbox/maps/blob/main/android/install.md

Alreadywinner commented 5 months ago

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.