简体   繁体   中英

Mapbox - FAILURE: Build failed with an exception. (Flutter)

I am using mapbox gl demo for my flutter application and getting below error at the time of running my flutter application in Android device:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeDebugAssets'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0. Required by: project:app > project:mapbox_gl > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0 > Could not resolve com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0. > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom'. > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom'. Received status code 403 from server: Forbidden

  • 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 2m 51s [.] Gradle threw an error while downloading artifacts from the network: Retrying Gradle Build, #1: wait time. 100ms Running Gradle task 'assembleDebug'...

Referring this link to integrate : https://github.com/flutter-mapbox-gl/maps#downloading-offline-regions

What might be issue? Thanks.

Add the following to your android/build.gradle under section 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'] ?: ""
    }
}

Got this hint from here https://github.com/rnmapbox/maps/issues/1501#issuecomment-906158991

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM