I'm using flutter_mapbox_navigation to navigate in my flutter app. I add it and set all configuration things. I add it in debug mode with android studio and the app works fine in android and in iOS.
But if instead of run it, I try to build apk I get this error:
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':flutter_mapbox_navigation:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/nicolasvermi/Documents/development/myzona-flutter/build/flutter_mapbox_navigation/intermediates/merged_res/release/layout/navigation_activity.xml:2: AAPT: error: resource string/mapbox_access_token (aka eopeter.flutter_mapbox_navigation:string/mapbox_access_token) not found.
My flutter doctor here:
Doctor summary (to see all details, run flutter doctor -v):
- [✓] Flutter (Channel stable, 3.7.11, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
- [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
- [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
- [✓] Chrome - develop for the web
- [✓] Android Studio (version 2021.3)
- [✓] Android Studio (version 2021.3)
- [✓] IntelliJ IDEA Community Edition (version 2022.3.2)
- [✓] Connected device (2 available) [✓] HTTP Host Availability
android build.gradle code:
buildscript {
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = project.properties['MY SecretKey'] ?: ""
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = project.properties['MY SecretKey'] ?: ""
}
}
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-location:21.0.1"
}
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I fix it by following some instruction in this link https://github.com/eopeter/flutter_mapbox_navigation/issues/211