IllegalAccessError:预验证类中的类ref解析为意外实现

时间:2012-03-13 12:52:56

标签: android

当我运行Android应用程序时,遇到此NoClassDefFoundError

03-13 18:06:38.648: E/AndroidRuntime(413): Uncaught handler: thread main exiting due to uncaught exception
03-13 18:06:38.688: E/AndroidRuntime(413): java.lang.NoClassDefFoundError: com.InternetGMBH.ThousandPS.Activities.DealerDetailsDisplay
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.InternetGMBH.ThousandPS.Activities.DealerListAdapter$1.onClick(DealerListAdapter.java:76)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.View.performClick(View.java:2364)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.View.onTouchEvent(View.java:4179)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.widget.TextView.onTouchEvent(TextView.java:6540)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.View.dispatchTouchEvent(View.java:3709)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.os.Looper.loop(Looper.java:123)
03-13 18:06:38.688: E/AndroidRuntime(413):  at android.app.ActivityThread.main(ActivityThread.java:4363)
03-13 18:06:38.688: E/AndroidRuntime(413):  at java.lang.reflect.Method.invokeNative(Native Method)
03-13 18:06:38.688: E/AndroidRuntime(413):  at java.lang.reflect.Method.invoke(Method.java:521)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-13 18:06:38.688: E/AndroidRuntime(413):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-13 18:06:38.688: E/AndroidRuntime(413):  at dalvik.system.NativeStart.main(Native Method)
03-13 18:06:38.688: E/AndroidRuntime(413): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
03-13 18:06:38.688: E/AndroidRuntime(413):  at dalvik.system.DexFile.defineClass(Native Method)
03-13 18:06:38.688: E/AndroidRuntime(413):  at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
03-13 18:06:38.688: E/AndroidRuntime(413):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
03-13 18:06:38.688: E/AndroidRuntime(413):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-13 18:06:38.688: E/AndroidRuntime(413):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)

如何解决这个问题?

2 个答案:

答案 0 :(得分:4)

我刚刚点击并解决了这个问题 - 您需要将android项目的pom.xml中的所有依赖项添加到测试项目pom.xml中,其中包含提供的范围

根据此错误报告: http://code.google.com/p/maven-android-plugin/issues/detail?id=142

e.g。

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
            <scope>provided</scope>
        </dependency>

答案 1 :(得分:0)

正在提出

NoClassDefFoundError异常。基本上,在项目中找不到类定义。

正确检查类的名称,如果使用第三方库,请正确检查类的名称并确保包含库(类名称区分大小写)。