【发布时间】:2017-11-25 00:49:14
【问题描述】:
我遇到了一个奇怪的问题,阻止了我进一步开发我的应用程序。 我需要使用 Viewpager 和一些选项卡(TabLayout)制作一个 UI,为了实现这一点,我需要编译 android 设计和 appcompat 库。 但问题来了,它一直告诉我“ColorAccent”已经用不兼容的格式定义了。
我已尽我所能修复,但似乎无法正常工作。有没有人解决这个问题?请帮忙!
这是我的错误日志:
~ my path at MyApp's directory app\build\intermediates\res\merged\debug\values\values.xml
Error:(148) Attribute "colorAccent" already defined with incompatible
format.
Error:(3) Original attribute defined here.
Error:(148) Attribute "colorAccent" already defined with incompatible
format.
Error:(3) Original attribute defined here.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
编辑:这是我的构建代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "tap.myapp"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-v4:24.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.volley:volley:1.0.0'
compile "com.android.support:support-v4:24.2.1"
compile "com.android.support:appcompat-v7:24.2.1"
compile "com.android.support:support-annotations:24.2.1"
compile 'com.google.zxing:core:3.2.0'
compile 'com.android.support:recyclerview-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
【问题讨论】:
-
显示您的完整应用级 gradle 文件(“构建代码”下的内容)。
-
@DanielNugent 请检查编辑
-
用
buildToolsVersion "24.2.1"试试看同时删除你有compile 'com.android.support:support-v4:24.2.1'的两行,因为appcompat v7 库会自动导入支持v4 库,所以不需要它们。此外,它可能与编译的注释相冲突(把那个留在那里) -
@DanielNugent 谢谢你的回答,我现在就试试,我会来反馈的
-
@DanielNugent 我试过了,但它说:安装构建工具 24.2.1 并同步项目,我点击后,它显示所有包都无法下载!
标签: android gradle build compilation