错误:(773)属性“ titleTextStyle”已经被定义 [英] Error:(773) Attribute "titleTextStyle" has already been defined
问题描述
我正在尝试将项目从 Eclipse 迁移到 Android Studio ,并且在搜索了问题之后,我找到了答案此处。不幸的是,我的应用程序同时需要 ActionBarSherlock 库和 appcompat-v7 。在Eclipse中这不是问题,所以Android Studio为什么要抱怨?而且,除了用替代方法替换所需的 ActionBarSherlock 方法之外,还有谁能想到解决方案?我已经研究过了,并且至少要花几周的时间才能完成,这会耽误我的交货时间。
I'm trying to migrate a project from Eclipse to Android Studio and after googling the problem I found an answer here. Unfortunately, my app requires both the ActionBarSherlock library and appcompat-v7. This wasn't a problem in Eclipse, so why should Android Studio complain? Also, can anyone think of a solution, short of replacing the needed ActionBarSherlock methods with alternatives? I've looked into that and I see at least a couple of weeks of work ahead, which would blow my delivery schedule.
我的gradle文件如下:
My gradle file looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
apply plugin: 'android'
dependencies {
compile project(':ActionBarSherlock:library')
compile project(':HoloColorPicker')
compile project(':Android-PullToRefresh:library')
compile project(':ckChangeLog:library')
compile files('libs/commons-io-2.0.1.jar')
compile files('libs/htmlcleaner-2.2.jar')
compile files('libs/jutf7-1.0.1-SNAPSHOT.jar')
compile files('libs/jzlib-1.0.7.jar')
compile files('libs/bugsense-3.6.jar')
compile files('libs/apache-mime4j-dom-0.7.2.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile 'com.android.support:appcompat-v7:23.3.0'
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
推荐答案
首先,您必须删除lib并添加依赖项,然后像这样从ActionBarSherlock替换为AppCompat
First you have to remove lib and add dependencies and then replace from ActionBarSherlock to AppCompat like this
代码替换:
- SherlockActivity-> AppCompatActivity
- SherlockFragmentActivity-> FragmentActivity
- SherlockListActivity-> ListActivity(请参阅ListActivity / SherlockListActivity)
- SherlockListFragment-> ListFragment;
- getSupportMenuInflater-> getMenuInflater
- getSherlockActivity()-> getActivity()
- com.actionbarsherlock.widget .SearchView.OnQueryTextListener()-> OnQueryTextListener(请参阅SearchView)
- m.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); -> MenuItemCompat.setShowAsAction(m,MenuItem.SHOW_AS_ACTION_ALWAYS);
- SherlockActivity -> AppCompatActivity
- SherlockFragmentActivity -> FragmentActivity
- SherlockListActivity -> ListActivity (see ListActivity / SherlockListActivity)
- SherlockListFragment -> ListFragment;
- getSupportMenuInflater -> getMenuInflater
- getSherlockActivity() -> getActivity()
- com.actionbarsherlock.widget.SearchView.OnQueryTextListener() -> OnQueryTextListener (see SearchView)
- m.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); -> MenuItemCompat.setShowAsAction(m, MenuItem.SHOW_AS_ACTION_ALWAYS);
如果此更改无效,请尝试这个 https://stackoverflow.com/a/41243220/7235539
这篇关于错误:(773)属性“ titleTextStyle”已经被定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!