问题
i try import eclipse project to android studio and get this error
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
and i figure it out appcombat is conflict with actionbarsherlock. i try to migrate from abs to appcombat but. seems the project i got is hardcoded with actionbarsherlock. so its imposible for me. i decide to exclude the appcombat so the actionbarsherlock work without conflict.
here's my gradle
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')
}
its bit oldy project, but its all i need. in these gradle. i dont see the appcombat depencies. so how to exclude appcombat from android studio?
回答1:
ActionBarSherlock was [DEPRECATED]
remove ActionBarSherlock from your project and use Appcompat library to have actionBar on old versions.
appcompat usage:
in your Gradle file add:
compile 'com.android.support:appcompat-v7:23.0.1'
in style file set appcompat as your parent theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
extent your activity from AppCompatActivity:
public class MainActivity extends AppCompatActivity
来源:https://stackoverflow.com/questions/32466115/android-studio-appcompat-conflict-with-actionbarsherlock