Viv*_*hra 7 android android-gradle-plugin
我在尝试构建项目时遇到此错误.
Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Home\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
Run Code Online (Sandbox Code Playgroud)
当我点击它时,它将带我到生成的文件夹的v-23值文件,其中包含以下代码.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CardView" parent="Base.CardView">
<item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
这是我的app gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.commit451:inkpageindicator:1.0.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'ch.acra:acra:4.5.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.code.gson:gson:2.6.2'
}
Run Code Online (Sandbox Code Playgroud)
当我将gradle中的所有内容更改为版本23时,此错误消失了但是因为我使用的是http库而且它们已从23版本中删除,因此我被迫使用22版本.我的项目之前工作得非常好,突然间它开始出现这个错误.我所做的只是安装一个我在其他项目中使用的支持存储库,它也开始在这个项目中给出错误.有没有办法解决这个错误?
小智 17
compile 'com.facebook.android:facebook-android-sdk:4.+'
需要V-23
在我的情况下,我使用v-22所以我将Facebook sdk版本更改为4.8
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
这个错误非常有意义,因为?android:attr/colorBackgroundFloating
它只是在API 23中添加而你正在使用compileSdkVersion 22.
因此,要修复错误,您需要compileSdkVersion 23在构建中包含该资源.此外,拥有一个v23值文件时没有意义targetSdkVersion 22,这表示您不会瞄准v23设备.
你提到你正在使用的"http库"已经消失了吗?如果您HttpClient从org.apache包中提到,那么您可以通过将其包含在您的包中来添加它build.grade
android {
useLibrary 'org.apache.http.legacy'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6894 次 |
| 最近记录: |