的VerifyError - 验证拒绝类 [英] VerifyError - Verifier rejected class

查看:249
本文介绍了的VerifyError - 验证拒绝类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发2.2(的minSdkVersion = 8 ),并突然向我这个错误:

I'm developing for 2.2 (minSdkVersion=8) and suddenly I'm getting this error:

arbitrarily rejecting large method (regs=75 count=28584)
rejected Lcom/Demo/Loyalty/SelectType;.onClick (Landroid/view/View;)V
Verifier rejected class Lcom/Demo/Loyalty/SelectType;
Class init failed in newInstance call (Lcom/Demo/Loyalty/SelectType;)


java.lang.VerifyError: com.Demo.Loyalty.SelectType
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)

这是工作细到现在。

It was working fine until now.

注意:选择类型类有16000左右code线,但不是大型我猜

Note : SelectType class has around 16000 lines of code but that is not that large I guess.

我搜索了很多净和答案,我当时以下内容:

I search a lot on net and from answers, I did following:


  • 清洁项目

  • 重置ADB

  • 重新启动模拟器/设备/月食

  • 经过第三方库字段在构建路径检查

但我仍然收到这个错误。

But I'm still getting that error.

任何帮助AP preciated。

Any help appreciated.

推荐答案

您可能已经说明不会帮助的步骤。

The steps you've described probably won't help.

问题是,这不是一个问题,Dalvik的。类似的验证采用了Oracle Java虚拟机为例。答案很简单:你的方法太复杂的。您所看到的错误主要是由于过多的:

The thing is, it's not a Dalvik issue. Similar verifier is employed in the Oracle Java VM for example. Simple answer: your method is too complex. The error you see is mainly caused by too many:


  • 参数

  • 局部变量

  • 异常处理

  • code说明

更多precisely,这个问题已经在此线程描述:的https://groups.google.com/forum/?fromgroups=#!topic/android-developers/4qNoIdBHYFc

More precisely, the issue has been described in this thread: https://groups.google.com/forum/?fromgroups=#!topic/android-developers/4qNoIdBHYFc

要报价:

的值(寄存器个数*的指令字数)
  大于2 ^ 21。 (......)
  它的目的是
  prevent从胃胀了一个应用程序的本地堆验证。

The value of (number of registers * number of instruction words) is larger than 2^21. (...) it's intended to prevent the verifier from bloating up an app's native heap.

您还可以在这里看到类似的报告:<一href=\"http://www.mentby.com/Group/android-developers/verifyerror-arbitrarily-rejecting-large-method.html\" rel=\"nofollow\">http://www.mentby.com/Group/android-developers/verifyerror-arbitrarily-rejecting-large-method.html关于如何解决这个问题指针:

You can also see similar report here: http://www.mentby.com/Group/android-developers/verifyerror-arbitrarily-rejecting-large-method.html with pointers on how to resolve the issue:

是的,在Dalvik编译器试图分配一个注册到每一个
  在该方法的局部变量。它应该能够处理许多,
  但显然不能。通过使它们的实例变量删除
  编译器的需求/欲望管理他们(也使该方法
  相当数量较小)。

Yep, the Dalvik compiler attempts to assign a "register" to every local variable in the method. It should be able to handle that many, but apparently can't. By making them instance variables you remove the compiler's need/desire to "manage" them (and also make the method a fair amount smaller).

所以要解决它,你应该打破一般大的方法(可能是的onClick()?)成小块。此外,转换局部变量类字段似乎帮助一些人有同样的问题。

So to solve it, you should generally break the large method (probably onClick()?) into smaller pieces. Also, converting local variables to class fields seemed to help some people with the same issue.

这篇关于的VerifyError - 验证拒绝类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆