1

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 } 
6
  • can you please add the code which you've used in android/build.gradle ? Commented Apr 14, 2023 at 5:51
  • yes, I add it in the post Commented Apr 14, 2023 at 9:55
  • you added your secret key in android/gradle.properties ? Commented Apr 14, 2023 at 15:36
  • yes, in this way org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true MAPBOX_DOWNLOADS_TOKEN=sk.******* Commented Apr 17, 2023 at 9:33
  • Yeah si technically your variable name MAPBOX_DOWNLOAD_TOKEN should be replaced by MY SecretKey which you declared in android/build.gradle Commented Apr 17, 2023 at 17:43

2 Answers 2

0

You can add a release resource by clicking the "res" folder under your android app and do "New Resource" if using Android Studio and specify if you would like to add a main, debug, release resource as shown in the screenshot below:

Add config Specific Resource

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your suggestion. But I think the problem is not to add a resource but to find it. It not works for my case your solution.
0

I fix it by following some instruction in this link https://github.com/eopeter/flutter_mapbox_navigation/issues/211

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.