【发布时间】:2017-01-19 07:29:18
【问题描述】:
我目前正在尝试将我的 android 项目从 Eclipse 迁移到 Android Studio。构建项目失败并出现以下错误:
:app:processDebugResources
.../app/build/intermediates/res/merged/debug/values/values.xml
错误:(204) 属性“divider”已被定义
错误:(233) 属性“颜色”已被定义
这是 valuex.xml 的第 204 行
<declare-styleable name="MyView"><attr format="dimension" name="off"/><attr format="integer" name="host_mode"/><attr format="dimension" name="h_textSize"/><attr format="dimension" name="header_textSize"/><attr format="dimension" name="h_rx"/><attr format="dimension" name="h_ry"/><attr format="dimension" name="divider_height"/><attr format="color" name="divider"/><attr format="dimension" name="chat_divider_height"/><attr format="color" name="chat_divider"/><attr format="color" name="background_color"/><attr format="boolean" name="use_name"/></declare-styleable>
模块 gradle 文件:
dependencies {
compile 'com.android.support:support-v4:24.2.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/alljoyn.jar')
compile files('libs/peergroupmanager.jar')
}
有谁知道问题出在哪里?
更新: 这是模块的完整 gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.3"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 24
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:24.2.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/alljoyn.jar')
compile files('libs/peergroupmanager.jar')
}
更新 2: 我根据 xhamr 更改了我的 gradle 文件。我现在收到一条不同的错误消息:
:app:processDebugResources
../app/build/intermediates/res/merged/debug/values/values.xml
错误:(204) 属性“divider”已经定义为不兼容
格式。错误:(182) 此处定义的原始属性。
第 182 行:
<declare-styleable name="ActionBar"><attr name="navigationMode"><enum name="normal" value="0"/><enum name="listMode" value="1"/><enum name="tabMode" value="2"/></attr><attr name="displayOptions"><flag name="none" value="0"/><flag name="useLogo" value="0x1"/><flag name="showHome" value="0x2"/><flag name="homeAsUp" value="0x4"/><flag name="showTitle" value="0x8"/><flag name="showCustom" value="0x10"/><flag name="disableHome" value="0x20"/></attr><attr name="title"/><attr format="string" name="subtitle"/><attr format="reference" name="titleTextStyle"/><attr format="reference" name="subtitleTextStyle"/><attr format="reference" name="icon"/><attr format="reference" name="logo"/><attr format="reference" name="divider"/><attr format="reference" name="background"/><attr format="reference|color" name="backgroundStacked"/><attr format="reference|color" name="backgroundSplit"/><attr format="reference" name="customNavigationLayout"/><attr name="height"/><attr format="reference" name="homeLayout"/><attr format="reference" name="progressBarStyle"/><attr format="reference" name="indeterminateProgressStyle"/><attr format="dimension" name="progressBarPadding"/><attr name="homeAsUpIndicator"/><attr format="dimension" name="itemPadding"/><attr format="boolean" name="hideOnContentScroll"/><attr format="dimension" name="contentInsetStart"/><attr format="dimension" name="contentInsetEnd"/><attr format="dimension" name="contentInsetLeft"/><attr format="dimension" name="contentInsetRight"/><attr format="dimension" name="elevation"/><attr format="reference" name="popupTheme"/></declare-styleable>
【问题讨论】:
-
你能分享完整的 build.gradle 吗?它可能有助于理解这个问题
-
我更新了我的问题
标签: android eclipse android-studio gradle eclipse-adt