执行 android 构建时出现以下错误?
Posted
技术标签:
【中文标题】执行 android 构建时出现以下错误?【英文标题】:Getting following error while performing the android build? 【发布时间】:2018-11-13 00:09:05 【问题描述】:\platforms\android\build\intermediates\res\merged\debug\values-v28\values-v28.xml:7:41-73: AAPT: 找不到与给定名称匹配的资源(在 'dialogCornerRadius'值'?android:attr/dialogCornerRadius')
在构建 android apk 时出现此错误。尝试使用 CompileSdkVersion = 27,BuildToolsVersion = "26.0.2"。还有一件事我没有使用 android studio 我只是使用命令行工具作为 sdk 管理器。我的 build.gradle 文件看起来像这样。
ext
apply from: 'CordovaLib/cordova.gradle'
// The value for android.compileSdkVersion.
if (!project.hasProperty('cdvCompileSdkVersion'))
cdvCompileSdkVersion = 27;
// The value for android.buildToolsVersion.
if (!project.hasProperty('cdvBuildToolsVersion'))
cdvBuildToolsVersion = "26.0.2";
// Sets the versionCode to the given value.
if (!project.hasProperty('cdvVersionCode'))
cdvVersionCode = 1
// Sets the minSdkVersion to the given value.
if (!project.hasProperty('cdvMinSdkVersion'))
cdvMinSdkVersion = 15
// Whether to build architecture-specific APKs.
if (!project.hasProperty('cdvBuildMultipleApks'))
cdvBuildMultipleApks = null
// .properties files to use for release signing.
if (!project.hasProperty('cdvReleaseSigningPropertiesFile'))
cdvReleaseSigningPropertiesFile = null
// .properties files to use for debug signing.
if (!project.hasProperty('cdvDebugSigningPropertiesFile'))
cdvDebugSigningPropertiesFile = null
// Set by build.js script.
if (!project.hasProperty('cdvBuildArch'))
cdvBuildArch = null
// Plugin gradle extensions can append to this to have code run at the end.
cdvPluginPostBuildExtras = []
我的依赖是
dependencies
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:+"
compile "com.android.support:appcompat-v7:+"
compile "com.google.android.gms:play-services-location:+"
compile "com.android.support:support-v13:23+"
compile "com.google.android.gms:play-services-gcm:11+"
compile "me.leolin:ShortcutBadger:1.1.14@aar"
// SUB-PROJECT DEPENDENCIES END
【问题讨论】:
【参考方案1】:cordova plugin add cordova-android-support-gradle-release --fetch --variable ANDROID_SUPPORT_VERSION=23.+ --save
这个插件解决了我的问题。
【讨论】:
以上是关于执行 android 构建时出现以下错误?的主要内容,如果未能解决你的问题,请参考以下文章
构建 Android React Native 时出现错误的网关
尝试生成 ionic 项目的 android 或 ios 构建时出现错误