MergeAdapter 出现问题
当使用 Mark Murphy 的 MergeAdapter 时,一切都可以正常编译,但是当 ListView 绑定发生时,在调用 addAdapter() 方法时出现以下错误,导致崩溃:
java.lang.NoClassDefFoundError: com.commonsware.cwac.sacklist.SackOfViewsAdapter< /code>
SackOfViewsAdapter jar 文件确实存在于 cwac-merge 项目的 libs 目录中。
我已经检查了该项目附带的演示项目,但我看不到任何我没有的东西,尽管当我尝试运行它时出现 NoClassDefFoundError 异常。
我感觉这是一个 Eclipse 配置问题,但我已经尝试了我能想到的一切。
有什么想法吗?
** 更新:SackOfViewsAdapter 也显示为 CWAC-Merge 项目中的引用库。
** 更新 2:我的 .classpath:
<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 kind="lib" path="/Users/colsen/Projects/android/cwac-merge/libs/CWAC-SackOfViewsAdapter.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
** 更新 3 - 将 SackOfViewsAdapter 复制到本地 libs 目录。
<classpath>
<classpathentry kind="lib" path="libs/CWAC-SackOfViewsAdapter.jar"/>
<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 kind="output" path="bin/classes"/>
</classpath>
When using Mark Murphy's MergeAdapter everything compiles fine, but when the ListView binding occurs I get a crash with the following error when calling the addAdapter() method:
java.lang.NoClassDefFoundError: com.commonsware.cwac.sacklist.SackOfViewsAdapter
The SackOfViewsAdapter jar file does exist within libs dir of the cwac-merge project.
I have checked out the demo project that comes with the project and I can't see anything that it has that I don't, although I get NoClassDefFoundError exceptions when I try to run it.
I have a feeling this is an Eclipse configuration issue, but I have tried everything that I can think of.
Any ideas?
** Update: the SackOfViewsAdapter also shows up as a referenced library in the cwac-merge project.
** Update 2: My .classpath:
<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 kind="lib" path="/Users/colsen/Projects/android/cwac-merge/libs/CWAC-SackOfViewsAdapter.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
** Update 3 - copied SackOfViewsAdapter to local libs dir.
<classpath>
<classpathentry kind="lib" path="libs/CWAC-SackOfViewsAdapter.jar"/>
<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 kind="output" path="bin/classes"/>
</classpath>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您还需要使用
MergeAdapter
将SackOfViewsAdapter.jar
添加到项目的 Eclipse 构建路径中。尽管库项目对此的引用在编译时有效,但在运行时不起作用。我刚刚更新了
demo/
Eclipse 项目文件来反映这一点。对于造成的困难,我深表歉意。
It looks like you need to also add
SackOfViewsAdapter.jar
to your Eclipse build path of the project usingMergeAdapter
. Even though the library project's reference to this works at compile time, it will not work at runtime.I just updated the
demo/
Eclipse project files to reflect this.My apologies for the difficulty.