Android-DirectionalViewPager:NoClassDefFoundError:com.directionalviewpager.DirectionalViewPager $ DataSetObserver

时间:2012-12-11 11:39:59

标签: android android-layout

当我尝试将Android-DirectionalViewPager合并到一个新项目中时,我收到此错误:

-02 13:04:03.439: E/AndroidRuntime(1526): FATAL EXCEPTION: main
10-02 13:04:03.439: E/AndroidRuntime(1526): java.lang.NoClassDefFoundError: com.directionalviewpager.DirectionalViewPager$DataSetObserver

此处'从View designer重新记录日志:

  

com.directionalviewpager.DirectionalViewPager无法实例化。

     

抛出java.lang.ClassNotFoundException:   android.support.v4.view.PagerAdapter $ DataSetObserver         在java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)         在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)         at java.security.AccessController.doPrivileged(Native Method)         在java.net.URLClassLoader.findClass(URLClassLoader.java:354)         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)         at java.lang.ClassLoader.defineClass1(Native Method)         at java.lang.ClassLoader.defineClass(ClassLoader.java:791)         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)         at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)         在java.net.URLClassLoader.access $ 100(URLClassLoader.java:71)         在java.net.URLClassLoader $ 1.run(URLClassLoader.java:361)         在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)         at java.security.AccessController.doPrivileged(Native Method)         在java.net.URLClassLoader.findClass(URLClassLoader.java:354)         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)         在com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.loadClassFromJar(ProjectClassLoader.java:242)         在com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.findClass(ProjectClassLoader.java:76)         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)         at java.lang.ClassLoader.loadClass(ClassLoader.java:410)         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)         at java.lang.Class.getDeclaredConstructors0(Native Method)         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)         at java.lang.Class.getConstructor0(Class.java:2714)         在java.lang.Class.getConstructor(Class.java:1674)         在com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:338)         在com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:170)         在android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)         在android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)         在android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)         在android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)         在android.view.LayoutInflater.rInflate(LayoutInflater.java:718)         在android.view.LayoutInflater.inflate(LayoutInflater.java:489)         在android.view.LayoutInflater.inflate(LayoutInflater.java:372)         在com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:321)         在com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:331)         在com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)         在com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)         在com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)         在com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)         在com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1059)         在com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:683)         在com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)         at org.eclipse.ui.part.MultiPageEditorPart $ 2.widgetSelected(MultiPageEditorPart.java:290)         at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)         在org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)         在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)         在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)         在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)         在org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1061)         在org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2746)         在org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1433)         在org.eclipse.swt.custom.CTabFolder $ 1.handleEvent(CTabFolder.java:257)         在org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)         在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)         在org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)         在org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)         在org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)         在org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)         在org.eclipse.ui.internal.Workbench.access $ 4(Workbench.java:2499)         在org.eclipse.ui.internal.Workbench $ 7.run(Workbench.java:679)         在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)         在org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)         在org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)         在org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)         在org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)         在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)         在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)         在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)         在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:601)         在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)         在org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)         在org.eclipse.equinox.launcher.Main.run(Main.java:1410)         在org.eclipse.equinox.launcher.Main.main(Main.java:1386)

eclipse.buildId=M20120208-0800
java.version=1.7.0_07
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

有什么建议吗?

P.S。我已经加入了图书馆并支持图书馆。

1 个答案:

答案 0 :(得分:4)

我遇到了类似的问题,原因是DirectionalViewPager库使用的android-support-v4.jar库是旧版本,使其与当前使用的版本不兼容。也许您可以使用以下库进行更换。 https://github.com/castorflex/VerticalViewPager

此外,您还可以参考以下链接可能会有所帮助。 Error including Android-DirectionalViewPager .jar in Eclipse