我使用flutter_mapbox_navigation在我的flutter应用程序中导航。我添加它并设置所有配置。我在android studio的调试模式下添加它,应用程序在android和iOS中运行良好。
但是如果我没有运行它,而是尝试构建apk,我会得到这个错误:
失败:生成失败,出现异常。
- 出了什么问题:任务“:flutter_mapbox_navigation:verifyReleaseResources”执行失败。
执行com.android.build.gradle.tasks时发生故障。VerifyLibraryResourcesTask$Action Android资源链接失败ERROR:/Users/nicolasvermi/Documents/development/myzona-flutter/build/flutter_mapbox_navigation/intermediates/merged_res/release/layout/navigation_activity.xml:2:AAPT:错误:资源字符串/mapbox_access_token(aka eopeter.flutter_mapbox_navigation:string/mapbox_access_token)未找到。
我的Flutter医生在这里:
Doctor摘要(要查看所有详细信息,请运行flutter doctor -v):
- [✓] Flutter(Channel stable,3.7.11,on macOS 13.1 22C65 darwin-arm64,locale en-GB)
- [✓] Android工具链-为Android设备开发(Android SDK版本33.0.1)
- [✓] Xcode -为iOS和macOS开发(Xcode 14.3)
- [✓] Chrome -为Web开发
- [✓] Android Studio(版本2021.3)
- [✓] Android Studio(版本2021.3)
- [✓] IntelliJ IDEA社区版(版本2022.3.2)
- [✓]连接的设备(2可用)[✓] HTTP主机可用性
android build.gradle代码:
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
}
1条答案
按热度按时间ffscu2ro1#
您可以通过单击Android应用下的“res”文件夹添加发布资源,如果使用Android Studio,则执行“New Resource”,并指定是否要添加主资源、调试资源和发布资源,如下图所示: