使用ActionBarSherlock库,错误使用后夏洛克作为库 [英] use ActionBarSherlock library, error after use sherlock as library

查看:221
本文介绍了使用ActionBarSherlock库,错误使用后夏洛克作为库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自己的项目使用的 Android 2.1的API 7

要落实行动起来吧,我用 ActionBarSherlock 库。我进口的夏洛特库到我的Eclipse作为现有项目。对于夏洛特,目标平台是的Andr​​oid 3.2版API 13

于是,我加的夏洛特作为一个库项目,以我自己的项目。然后,我注意到没有 R.java 在我自己的项目在 GEN / 文件夹中的文件,我得到了错误像Eclipse控制台以下内容:

  JakeWharton-ActionBarSherlock-436230d /库/ RES /值-V11 / abs__styles.xml:4:错误:错误检索父项:没有资源的发现,给定的名称匹配机器人:Theme.Holo。

JakeWharton-ActionBarSherlock-436230d /库/ RES /值-V11 / abs__styles.xml:48:错误:错误:未发现的资源匹配给定名称:ATTR机器人:actionBarSize。

JakeWharton-ActionBarSherlock-436230d /库/ RES /值-V11 / abs__styles.xml:49:错误:错误:未发现的资源匹配给定名称:ATTR机器人:actionBarStyle。

...
 

我认为这是因为在夏洛特应使用更高版本的API的可能,所以我试图目标平台上的夏洛特 4.03 API 15 STRONG>项目。但它并不能帮助。

有人使用大侦探经历了同样的错误?我该如何解决这个问题呢?

PS 我自己的项目清单文件:

 < XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
      包=my.frag.test
      安卓版code =1
      机器人:VERSIONNAME =1.0>
    <使用-SDK安卓的minSdkVersion =7/>

    <应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>
        <活动机器人:MyActivityNAME =
                  机器人:标签=@字符串/ APP_NAME>
            <意向滤光器>
                <作用机器人:名称=android.intent.action.MAIN/>
                <类机器人:名称=android.intent.category.LAUNCHER/>
            &所述; /意图滤光器>
        < /活性GT;

    < /用途>
< /舱单>
 

解决方案

您必须设置生成目标为API13对自己的项目。

最低API级别您的应用程序的工作原理上是由机器人定义:在的minSdkVersion您的清单,而不是构建目标

设置构建目标为API13不会使可在2.1设备的动作条,这就是为什么你有ActionBarSherlock。

My own project is using Android 2.1 API 7.

To implement action bar, I use ActionBarSherlock library. I imported the sherlock library into my Eclipse as an existing project. For sherlock, the target platform is Android v3.2 API 13 .

Then, I added sherlock as a library project to my own project. Then, I notice there is no R.java file under gen/ folder in my own project, and I got error like following in eclipse console:

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'.

...

I thought it was probably because of the sherlock should use higher version API, so I tried to set target platform to 4.03 API 15 on sherlock project. But it does not help.

Anyone use sherlock has experienced the same error?? How can I solve this problem?

P.S. my own project manifest file:

<?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>

解决方案

You have to set the build target to API13 on your own project.

The minimum API level your app works on is defined by android:minSdkVersion in your manifest, NOT the build target.

Setting the build target to API13 does NOT make the ActionBar available on 2.1 devices, and that is why you have ActionBarSherlock.

这篇关于使用ActionBarSherlock库,错误使用后夏洛克作为库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆