2015-09-08 93 views
0

Android Studio中程序兼容性衝突我嘗試導入Eclipse項目到Android工作室和得到這個錯誤與ActionBarSherlock

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就不會發生衝突。

這裏是我的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') 
} 

其位oldy項目,但它的一切我所需要的。在這些gradle中。我沒有看到appcombat的依賴。所以如何從android studio中排除appcombat?

+0

你爲什麼要需要兩個? – Blackbelt

+0

只是在你的依賴關係列表中,你不需要兩次'support-v4'依賴。 – anthonycr

+0

我只是弄明白,appcombat在編譯'com.android.support:support-v4:21.0.3'裏面太大聲了。即時通訊全新的。我只是刪除「編譯」com.android.support:support-v4:21.0.3'「行,仍然有錯誤。我只是谷歌,並發現該appcombat也在「com.google.android.gms:play-services」中。所以如何從「com.google.android.gms:play-services」中排除appcombat? – jchristsake

回答

0

ActionBarSherlock是從項目[DEPRECATED]

刪除ActionBarSherlock和使用程序兼容性庫中的動作條上的舊版本。

程序兼容性用法:

在搖籃文件中添加

compile 'com.android.support:appcompat-v7:23.0.1' 

風格文件程序兼容性設置爲你的父母主題:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 

程度的活動從AppCompatActivity:

public class MainActivity extends AppCompatActivity 
相關問題