English 中文(简体)
ADT 17之后, 我如何使用Action Barsherlock 和 Android Support v4 图书馆?
原标题:After ADT 17, how do I use ActionBarSherlock AND the Android Support v4 library?

我的应用程序使用 ActionBarsherlock, 并且一切都正常( 在 Dalvik 错误1 和 类似 ) 之后 。 现在我想使用 Android 支持 v4 库的类, 但我找不到它可以导入。 如果我将 v4 库( ABS 属性下) 设置为导出, 它会有效, 但是随后我得到了 Dalvik 错误1 ( 已添加) 错误 1 ( 已添加 ) 的错误 。

我如何使用这两个图书馆?

问题回答

若您在ABS方面仍有问题,请联系下列机构:

  • Creating a new project from scratch worked fine with ABS & support lib but my existing projects would not work after upgrading ADT, no matter what (ClassNotFoundException for main Activity)
  • I added the newest version of the support library to the ABS library project and the referencing projects but the exception still occurred
  • Finally I compared all configuration files of the working new project and my existing projects and found the following difference:

现有项目:

<classpath>
  <classpathentry kind="src" path="src"/><classpathentry kind="src" path="gen"/>
  <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>  
  <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
  <classpathentry kind="output" path="bin/classes"/>
</classpath>

新建的( 工作) 项目 :

<classpath>
  <classpathentry kind="src" path="src"/><classpathentry kind="src" path="gen"/>
  <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  <classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
  <classpathentry kind="output" path="bin/classes"/>
</classpath>

请注意, 在 XML 文件的不同节点上, 属性 < code> exported 设置为真实。 调整我现有工程中的 XML 文件后, 解决了我的问题 。

希望这能帮助其他人不要像我一样浪费太多时间。 )

编辑: 代码格式化

由于 ActionBarsherlock 本身依赖于 Android 支持软件包, 只要将 ActionBarsherlock 添加为您主工程的图书馆项目, 就可以自动访问 Android 支持软件包, 而不作任何修改 。 您可以在软件包探索器中看到您的 Android 依赖软件包中 < code> 和 mid- support- v4. jar

例如,这个样本项目 reference 这个ActionBarSherlock 的版本作为一个图书馆项目,它使用“code>android.supid.v4.app.通知Compt ,没有发行。

Found out it was my old version of ViewPagerIndicator that was causing the issue. Updating to the May version fixed it, but I had to make some small changes in my Adapter.





相关问题
In Eclipse, why doesn t "Show In" appear for non-Java files?

If I have a *java file open, I can right click on the source, scroll down to "Show In (Alt-Shift-W)", and select Navigator. If I have an *xml, *jsp, or pretty much anything besides a Java source ...

Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

Eclipse smart quotes - like in Textmate

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I m a newbie here so be ...

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with ...

Adding jar from Eclipse plugin runtime tab

I want to add .jar files for plugin from the Runtime tab of manifest file. When I use the Add... button, I can see only sub-directories of the plugin project. So if I want to add same .jar file to ...

How to copy multiple projects into single folder in eclipse

I have two projects, Project1 and Project2. Now i want to copy this projects into eclipse workspace but i want these projects to be in a single folder like below. Eclipse Workspace -> Project -> ...

Java: Finding out what is using all the memory

I have a java application that runs out of memory, but I have no idea which code is allocating the memory. Is there an application with which I can check this? I use Eclipse.

热门标签