【问题标题】:ActionBarSherlock 4.0 doesn't work. But 3.5.1 doActionBarSherlock 4.0 不起作用。但是 3.5.1 做
【发布时间】:2012-03-15 14:43:11
【问题描述】:

如果我使用 ActionBarSherlock 3.5.1,一切都很好并且可以正常工作。但是如果我想使用 4.0 RC1 我得到了错误。

[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.Solid'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:12: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.Solid.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabView.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabBar.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values/abs__styles.xml:101: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabText.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionMode.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values/abs__styles.xml:244: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:88: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Menu'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:93: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Title.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:97: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:101: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Title.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__styles.xml:105: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse'.
[2012-02-25 10:08:19 - SherlockApp] /home/leandros/workspace/ActionBarSherlock40/res/values-v14/abs__themes.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.

有什么想法吗?

【问题讨论】:

    标签: java android actionbarsherlock


    【解决方案1】:

    确保将(ActionBarSherlock 项目和您的项目的)目标 API 级别设置为 15。要执行此操作:

    1. 在两个 AndroidManifest.xml 文件中将 android:targetSdkVersion 更改为“15”。
    2. 使用项目属性(也可能是 ActionBarSherlock 和您的项目)将构建目标更改为“Android 4.0.3”(或等效的 3rd-Party API)。

    我没有找到任何有关此更改的文档,但只是通过试验“n”错误发现的。

    【讨论】:

    • 解决方案是对的。昨天我自己解决。不过还是谢谢。但无法回答我自己的问题:)
    • 如果使用 IntelliJ IDEA 则将 Module SDK 设置为 4.0.3+ 以获得相同的效果 :)
    • 在我按照您的步骤操作后得到了这个:E/AndroidRuntime(1508): 原因:java.lang.ClassNotFoundException: xxxx.XXXXActivity in loader dalvik.system.PathClassLoader[/mnt/asec/xxx .xxx-2/pkg.apk]
    • Jake 确实需要使用 ANT 进行自动化构建,这样他才能知道什么时候会破坏东西。我正在使用他的库作为 Git 子模块,我不想等待这样的修复并让我的东西坏了。
    • 我做了所有描述的事情,但我仍然在android:theme="@style/Theme.Sherlock.Light.DarkActionBar" 上收到no resource found [...]。也许你知道它还能是什么?
    【解决方案2】:

    Java 合规级别(项目 > 属性)设置为 1.6(而不是 1.5)为我完成了这项工作。

    更改 API 级别无效!

    【讨论】:

      【解决方案3】:

      右击库 -> 属性 -> Android -> 将项目构建目标设置为最新

      为您的项目遵循同样的方法。

      现在清理库和项目,这应该可以解决问题。

      【讨论】:

        【解决方案4】:

        如果你使用相同的

        android:minSdkVersion="?" android:targetSdkVersion="?"

        你的项目和图书馆项目的价值都应该得到解决。之后别忘了改变 android.target = ? (最大值) 在 project.properties 文件中。

        【讨论】:

          猜你喜欢
          • 2015-09-07
          • 2012-10-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-10-30
          • 2023-01-07
          • 1970-01-01
          相关资源
          最近更新 更多