“.access”的验证错误

发布于 2024-12-19 02:14:59 字数 1647 浏览 2 评论 0原文

将应用程序向后移植到 Android 1.5,我一直修复VerifyError 错误,但这里有一个比平时不那么明显的错误 (完整日志在这里):

W/dalvikvm( 6978): VFY: invalid reg type 8 on iput instr (need 6)
W/dalvikvm( 6978): VFY:  rejecting opcode 0x5c at 0x0004
W/dalvikvm( 6978): VFY:  rejected Lcom/ichi2/anki/CardEditor;.access$1776 (Lcom/ichi2/anki/CardEditor;I)Z
W/dalvikvm( 6978): Verifier rejected class Lcom/ichi2/anki/CardEditor;
W/dalvikvm( 6978): Class init failed in newInstance call (Lcom/ichi2/anki/CardEditor;)
D/AndroidRuntime( 6978): Shutting down VM
W/dalvikvm( 6978): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
E/AndroidRuntime( 6978): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 6978): java.lang.VerifyError: com.ichi2.anki.CardEditor
E/AndroidRuntime( 6978):    at java.lang.Class.newInstanceImpl(Native Method)

有趣的行似乎是:rejected Lcom/ichi2/anki/CardEditor;.access

令人困惑的是类 CardEditor 或其父类 Activity,在任何级别的公共 API。非API Android源代码实际上包含 ActivityThread.access,但我只使用公共 API。

CardEditor 类不导入任何已编译的库(jar 等)。导入语句要么是“android”。或者引用同一项目中的Java源文件,从而同时重新编译。如果这很重要,我总是这样编译:ant clean debug,由 Android SDK 自动创建的新 Ant 文件。

Back-porting an app to Android 1.5, I fix VerifyError bugs all the time, but here is one that is much less obvious than usual (full log here):

W/dalvikvm( 6978): VFY: invalid reg type 8 on iput instr (need 6)
W/dalvikvm( 6978): VFY:  rejecting opcode 0x5c at 0x0004
W/dalvikvm( 6978): VFY:  rejected Lcom/ichi2/anki/CardEditor;.access$1776 (Lcom/ichi2/anki/CardEditor;I)Z
W/dalvikvm( 6978): Verifier rejected class Lcom/ichi2/anki/CardEditor;
W/dalvikvm( 6978): Class init failed in newInstance call (Lcom/ichi2/anki/CardEditor;)
D/AndroidRuntime( 6978): Shutting down VM
W/dalvikvm( 6978): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
E/AndroidRuntime( 6978): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 6978): java.lang.VerifyError: com.ichi2.anki.CardEditor
E/AndroidRuntime( 6978):    at java.lang.Class.newInstanceImpl(Native Method)

The interesting line seems to be: rejected Lcom/ichi2/anki/CardEditor;.access

The baffling thing is that there is no access method in class CardEditor nor its parent class Activity, at any level of the public API. The non-API Android source code actually contains ActivityThread.access, but I use exclusively the public API.

This CardEditor class does not import any compiled libraries (jar or so). The import statements are either "android." or refer Java source files that are in the same project, and thus get recompiled at the same time. If that matters, here is how I always compile: ant clean debug, fresh Ant file created automatically by the Android SDK.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩饰不了的爱 2024-12-26 02:14:59

您可能遇到了 Dalvik 限制。方法不能生成超过 65535 个字节码。尝试找出 CardEditor 中最大的方法并将它们分成多个块。例如,通过调用其他方法而不是在每个“案例”之后直接编码,然后看看这是否有效。

请查看此链接

You may have faced with a Dalvik limitation. Methods cannot genereate more than 65535 bytecodes. Try to spot the biggest methods in CardEditor and split them into chunks. For example by calling other methods instead of coding directly after each 'case', and see if that works.

Please take a look at this link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文