java.lang.NoClassDefFoundError的:[通用]在dalvik.system.NativeStart.main(本机方法) [英] java.lang.NoClassDefFoundError: [generic] at dalvik.system.NativeStart.main(Native Method)

查看:493
本文介绍了java.lang.NoClassDefFoundError的:[通用]在dalvik.system.NativeStart.main(本机方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一些应用程序的用户得到这个例外

Some of users of my application got this exception

java.lang.NoClassDefFoundError: [generic] 
at dalvik.system.NativeStart.main(Native Method)

这不是常见的异常,因为用户的大量的,只有一些人有这样的例外。我不使用任何本机库和所有外部库不使用任何本地code

It's not common exception because of great number of users and only some of them have this exception. I don't use any native library and all externals libraries don't use any native code

Android的版本在那里发生了:

Version of Android where it happened:


  1. 的Andr​​oid 4.0.3 - 4.0.4 (97.7%)

  2. 的Andr​​oid 4.0 - 4.0.2 (1.5%)

  3. 的Andr​​oid 4.1 (0.8%)

  1. Android 4.0.3 - 4.0.4 (97.7%)
  2. Android 4.0 - 4.0.2 (1.5%)
  3. Android 4.1 (0.8%)

任何人可以帮助我解决方法吗?在AndroidManifest CAN接收器把这个问题?

Can anybody help me with workaround? Can receiver in AndroidManifest call this issue?

推荐答案

的NoClassDefFoundError [普通] 标签由VM抛出,从一个$ p $对 - 制造对象。唯一的例外没有有用的堆栈跟踪,但一般不会单独出现。

NoClassDefFoundError with the [generic] tag is thrown by the VM, from a "pre-fabricated" object. The exception has no useful stack trace, but does not generally appear by itself.

背景:类加载机制需要抛出异常时,类不能在一个装载程序找到。装载机必须推迟到其父加载器,因此,如果您尝试加载应用程序类,它首先会问的引导加载程序,这将失败,并抛出一个异常。然后应用程序加载器自身的查找,这很可能会成功。

Background: the class loader mechanism requires throwing exceptions when a class can't be found in a loader. Loaders have to defer to their parent loader, so if you try to load an application class, it will first ask the bootstrap loader, which will fail and throw an exception. The app loader then does its own lookup, which will probably succeed.

这意味着虚拟机分配一个例外,初始化对象,并在堆栈跟踪填充......然后把它扔了,因为这是不出来引导类加载器的每一个类。

This means the VM is allocating an exception, initializing the object, and filling in the stack trace... and then throwing it away, for every class that isn't coming out of the bootstrap class loader.

要避免无谓的分配,引导装载程序(在VM内执行)抛出一个通用的pre-分配异常对象。因为对象完全形成时,虚拟机启动时,它没有任何意义的堆栈跟踪信息。

To avoid pointless allocations, the bootstrap loader (implemented inside the VM) throws a generic pre-allocated exception object. Because the object is fully formed when the VM is starting up, it has no meaningful stack trace information.

在实践中,你看不到这些,因为应用程序通常不直接从引导加载程序加载的类。该应用程序或系统加载器为您创建一个有意义的异常。即使你直接从引导加载程序要求的一类,你应该只看到这个作为的原因一的ClassNotFoundException

In practice you don't see these, because applications don't generally load classes directly from the bootstrap loader. The application or system loader creates a meaningful exception for you. Even if you request a class from the bootstrap loader directly, you should only see this as the "cause" of a ClassNotFoundException.

DexClassLoader 写入使用错误code,而不是异常的当一个类无法找到,所以你不会看到这一切时通过这条道路。

The DexClassLoader was written to use an error code instead of an exception when a class can't be found, so you won't see this at all through that path.

如果在的NoClassDefFoundError 是一个较大的异常病因,你需要得到最外层的例外,因为这将有有意义的堆栈跟踪。如果你看到这些出现自己的话很奇怪的东西是干什么的 - 最有可能的code的某些位试图直接加载类,并通过而不是一个类加载器对象(这是你如何引用引导加载程序)。

If the NoClassDefFoundError is the "cause" of a larger exception, you need to get the outermost exception, as that will have the meaningful stack trace. If you're seeing these appear by themselves, then something very strange is doing on -- most likely some bit of code is attempting to load classes directly and is passing null instead of a classloader object (which is how you reference the bootstrap loader).

这篇关于java.lang.NoClassDefFoundError的:[通用]在dalvik.system.NativeStart.main(本机方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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