문제

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>
도움이 되었습니까?

해결책

The SackOfViewsAdapter jar file does exist within libs dir of the cwac-merge project.

It looks like you need to also add SackOfViewsAdapter.jar to your Eclipse build path of the project using MergeAdapter. 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top