Android 错误“无法解析虚拟方法 java/beans/PropertyDescriptor”是否有解决方法?
我正在尝试在 Android 应用程序中使用第三方 jar 文件。我已经能够很好地使用 jar 文件中的一些类。但是,其中一个类引用了 dalvik 虚拟机似乎不支持的一些 Java 类。以下是我在 LogCat 中看到的一些错误:
Unable to find class referenced in signature java/beans/PropertyDescriptor.
Unable to resolve virtual method java/beans/PropertyDescriptor.getName().
Unable to resolve virtual method java/beans/PropertyDescriptor.getReadMethod().
Unable to resolve static method java/beans/Introspector.getBeanInfo().
Unable to resolve exception class java/beans/IntrospectionException.
dalvik 似乎不支持与内省和反射相关的 Java 类。我想了解两件事。 dalvik 是否有计划在不久的将来支持这一点?其次,有没有人有解决这个问题的建议?
I am trying to use a third party jar file within an Android application. I have been able to use some of the classes in the jar file just fine. However, one of the classes references some Java classes that don't appear to be supported by the dalvik vm. These are some of the errors I am seeing in LogCat:
Unable to find class referenced in signature java/beans/PropertyDescriptor.
Unable to resolve virtual method java/beans/PropertyDescriptor.getName().
Unable to resolve virtual method java/beans/PropertyDescriptor.getReadMethod().
Unable to resolve static method java/beans/Introspector.getBeanInfo().
Unable to resolve exception class java/beans/IntrospectionException.
It appears that Java classes related to introspection and reflection are not supported by dalvik. I would like to find out two things. Is that a plan to support this in dalvik in the near future? Secondly, does anyone have a suggestion for a work around that would get around this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AFAIK,不是一揽子的。 Android 核心团队的目标之一是保持固件较小,以降低设备成本。这样做的一个副作用是仅包含他们认为必不可少的
java.*
和javax.*
中的类。最初,Android 中不存在java.beans.*
;现在,只有一些类和接口可用,但不是整个包。当我们其他人知道时,您就会知道,也就是说,只有当它出现在版本中时。
如果第三方 JAR 是开源项目:
java.beans
类并将它们放入您的项目中bondy.beans
),因为如果您尝试将java.beans
类加载到您的项目中,Android 不会很喜欢有可能 < a href="http://code.google.com/p/jarjar/" rel="noreferrer">jarjar 也可以对此做一些事情——我还没有使用过这个工具,不知道其能力的范围。
Not on a blanket basis, AFAIK. One objective of the core Android team is to keep the firmware small, to reduce the cost of devices. One side-effect of this is to only include classes from
java.*
andjavax.*
that they feel are essential. Originally, none ofjava.beans.*
existed in Android; now, a few classes and interfaces are available, but not the whole package.You will know when the rest of us know, which is to say, only if it shows up in a release.
If the third-party JAR is an open source project:
java.beans
classes from Apache Harmony and put them in your projectbondy.beans
), since Android will not like it much if you try loadingjava.beans
classes into your projectIt is possible that jarjar can do something about this as well -- I have not yet used the tool and do not know the extent of its capabilities.
Apache Harmony 已经退役很长时间了。我正在使用 openbeans。它为我解决了所有问题。
Apache harmony is retired for a long time now. I am using openbeans. And it solves all the problem for me.