【发布时间】:2015-12-04 15:06:34
【问题描述】:
我尝试将 eclipse 项目导入到 android studio 并得到这个错误
Error:(1) Attribute "titleTextStyle" has already been defined
Error:(1) Attribute "subtitleTextStyle" has already been defined
Error:(1) Attribute "divider" has already been defined
Error:(1) Attribute "background" has already been defined
Error:(1) Attribute "backgroundSplit" has already been defined
Error:(1) Attribute "navigationMode" has already been defined
Error:(1) Attribute "displayOptions" has already been defined
Error:(1) Attribute "title" has already been defined
Error:(1) Attribute "subtitle" has already been defined
Error:(1) Attribute "icon" has already been defined
我发现 appcombat 与 actionbarsherlock 冲突。我尝试从 abs 迁移到 appcombat 但是。似乎我得到的项目是用 actionbarsherlock 硬编码的。所以这对我来说是不可能的。我决定排除 appcombat,这样 actionbarsherlock 就可以正常工作。
这是我的毕业典礼
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "org.myapps.android"
minSdkVersion 9
targetSdkVersion 17
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':menudrawer')
compile project(':actionbarsherlock')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/httpmime-4.1.2.jar')
compile files('libs/tagsoup-1.2.1.jar')
compile files('libs/volley.jar')
compile files('libs/wordpresscom-android-rest-v0.0.3.jar')
}
它有点老旧的项目,但它就是我所需要的。在这些 gradle 中。我没有看到 appcombat 依赖项。那么如何从android studio中排除appcombat呢?
【问题讨论】:
-
为什么两者都需要?
-
仅供参考,您的依赖项列表中不需要两次
support-v4依赖项。 -
我只是发现 appcombat 也在 compile 'com.android.support:support-v4:21.0.3' 内部,哈哈。我对此完全陌生。我只是删除了“compile 'com.android.support:support-v4:21.0.3'”行,但仍然出现错误。我只是谷歌,发现 appcombat 也在“com.google.android.gms:play-services”内。那么如何从“com.google.android.gms:play-services”中排除appcombat?
-
如果您排除它,您可能会遇到问题。这是有原因的依赖。 ABS 已被弃用,因为它已经过时,而 AppCompat 取代了它,所以你真的应该更加努力地进行迁移。
标签: android eclipse android-studio actionbarsherlock android-appcompat