【发布时间】:2012-02-08 00:16:11
【问题描述】:
我自己的项目正在使用 Android 2.1 API 7。
为了实现动作栏,我使用ActionBarSherlock 库。我将 sherlock 库作为现有项目导入到我的 Eclipse 中。对于 sherlock,目标平台是 Android v3.2 API 13。
然后,我将 sherlock 作为库项目添加到我自己的项目中。然后,我注意到我自己的项目中gen/ 文件夹下没有R.java 文件,并且在eclipse控制台中出现如下错误:
JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:48: error: Error: No resource found that matches the given name: attr 'android:actionBarSize'.
JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:49: error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'.
...
我认为可能是因为 sherlock 应该使用更高版本的 API,所以我尝试在 sherlock 上将目标平台设置为 4.03 API 15强>项目。但这无济于事。
任何使用sherlock的人都遇到过同样的错误??我该如何解决这个问题?
P.S.我自己的项目清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.frag.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
【问题讨论】:
-
您的自己的项目是否针对 API 级别 7,或者它是 SDK 的最低值?尝试将其目标也设置为 15 级
-
@ Espiandev,我不明白你的意思。将我自己的项目设置为 15 级有什么意义?我的意思是sherlock应该被用来在我的项目(API 7)这样的旧版本API中拥有原生操作栏,如果我将自己的项目设置为使用API 15,那么在地球上拥有sherlock库有什么意义呢? ?