我们正在构建一个android项目,当我们尝试构建该项目时,我们会得到 Android资源构建失败
出于奇怪的原因,它指向的文件不属于我们项目的一部分,位于
C:\ location.gradle \ caches \ transforms-2 \ files-2.1 \ 87cdecd973dcf2cf22fdc9f513d1a506 \ RoundKornerLayouts-0.4.0 \ res \ values \ values.xml:4:5-258:AAPT:错误:资源找不到attr / top_left_corner_radius(aka com.package.android:attr/top_left_corner_radius)
我们尝试了following solutions,但没有成功
我们不知道为什么会出现此错误,其背后的原因是什么!粘贴gradle文件以获取更多详细信息
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://github.com/psiegman/mvn-repo/raw/master/releases'
}
maven {
url "http://dl.bintray.com/mobisystech/maven"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
App Build.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "in.studentkhabri.android"
manifestPlaceholders = [onesignal_app_id : 'hidden',
onesignal_google_project_number: 'REMOTE',
hostName : 'host_name'
]
minSdkVersion 17
targetSdkVersion 27
versionCode 1
multiDexEnabled true
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.zsoltsafrany:needle:1.0.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.github.nihad92:SwipeableCards:1.0.19'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.ncorti:slidetoact:0.5.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.mindorks.android:prdownloader:0.5.0'
implementation 'net.bohush.geometricprogressview:geometricprogressview:1.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
implementation 'com.devbrackets.android:exomedia:4.3.0'
//implementation 'com.dinuscxj:circleprogressbar:1.3.0'
//implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
implementation 'commons-io:commons-io:2.4'
implementation 'com.facebook.android:audience-network-sdk:4.99.1'
//implementation 'com.jaeger.statusbarutil:library:1.5.1'
implementation 'com.github.iammert:MusicPlayerView:e3b937c729'
implementation 'com.google.android.exoplayer:exoplayer:2.9.1'
implementation 'com.google.android.exoplayer:extension-rtmp:2.9.1'
implementation 'com.cleveroad:audiowidget:1.0.1'
implementation 'jp.wasabeef:glide-transformations:4.0.1'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.github.caneryilmaz:ZionFileDownloader:0.1.1'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.jcminarro:RoundKornerLayouts:0.4.0'
implementation 'com.github.sujithkanna:smileyrating:1.6.8'
implementation 'org.apache.commons:commons-lang3:3.0'
//implementation 'com.github.mosamabinomar:AndroidEqualizer:1.0'
//implementation 'com.ogaclejapan.smarttablayout:library:1.7.0@aar'
implementation project(':ProgressDialog')
implementation 'com.github.ixiDev:GDPRChecker:v0.2'
implementation 'com.google.android.ads.consent:consent-library:1.0.3'
implementation 'ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6'
implementation 'net.alexandroid.utils:exoplayerhelper:2.18'
implementation 'com.google.firebase:firebase-ads:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.7'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
答案 0 :(得分:1)
此错误绝对不严重。当Gradle在一个或多个XML文件中遇到错误(通常是语法或拼写错误)时,就会显示该错误。
大多数XML文件位于res文件夹中,但是,您仍然可以找到一些 在res文件夹之外。例如,位于“ /src/main/AndroidManifest.xml”中的AndroidManifest.xml。这是一个布局文件示例,该文件会出现“错误:链接文件资源失败”错误。
this.deviceInfo = deviceService.getDeviceInfo();
请注意“ android:endCollor”属性。
解决方案
所有您需要做的就是浏览每个XML文件,找出错误可能出在哪里。有时这可能很耗时,但是请放心,一旦找到并解决问题子项(问题XML),该错误就会消失。
您可能很幸运,Android Studio会为您指明确切的方向 在其他时间(例如,当您使用旧版本的Android Studio时),该错误并非特定于此。就是这样。希望您能弄清楚。