我遇到一个奇怪的问题,这使我无法进一步开发应用程序。
我需要制作一个带有Viewpager和一些选项卡(TabLayout)的UI,为了实现这一点,我需要编译android design和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'
}
最佳答案
固定的:我做错了是我在属性xml(attrs.xml)中声明了colorAccent变量,因此gradle无法编译该库,因为该特定值(color Accent)可能重复。删除该值可修复数小时以来我做错的事情。
关于android - 我无法将AppCompat-v7编译到我的Android Studio项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44687558/