编译失败:D8: Invalid stack map table at instruction 405

未关闭
#1,387 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
android, java

调研方向

Start with the supplied demo branch at commit bc31ff2 and reproduce the failure with ./gradlew :test-none-dynamic-host:assembleDebug. Inspect the D8 stack map errors in the listed Tencent Kona security classes and compare with the attempted fix from issue #1196 and commit 9ca4121. Done means identifying the cause and a fix that lets the assembly complete without these D8 errors.

由索引模型根据 Issue 内容生成。

描述

执行:./gradlew :test-none-dynamic-host:assembleDebug 任务时,编译失败
报错日志如下:

Task :test-plugin-general-cases:dexBuilderPluginDebug
WARNING:/Shadow/projects/test/plugin/general-cases/test-plugin-general-cases/build/intermediates/transforms/ShadowTransform/plugin/debug/83.jar: D8: Invalid stack map table at instruction 405: invokespecial javax.crypto.spec.IvParameterSpec.([BII)V, error: Could not assign '{0:Initialized(javax.crypto.spec.SecretKeySpec),1:Initialized(byte[]),2:Initialized(javax.crypto.spec.SecretKeySpec),3:int,4:Initialized(javax.crypto.spec.SecretKeySpec),5:Initialized(javax.crypto.spec.SecretKeySpec),6:Initialized(javax.crypto.spec.IvParameterSpec),7:uninitialized new,8:Initialized(java.lang.String),9:int,10:Initialized(byte[]),11:int,12:int,13:Initialized(byte[]),14:Initialized(java.security.MessageDigest),15:Initialized(java.security.MessageDigest)}' to '{0:oneword,1:Initialized(byte[]),2:Initialized(java.lang.Object),3:oneword,4:Initialized(javax.crypto.spec.SecretKeySpec),5:Initialized(javax.crypto.spec.SecretKeySpec),6:oneword,7:Initialized(javax.crypto.spec.IvParameterSpec),8:Initialized(java.lang.String),9:oneword,10:Initialized(byte[]),11:oneword,12:int,13:Initialized(byte[]),14:Initialized(java.security.MessageDigest),15:Initialized(java.security.MessageDigest)}'. The local at index 7 with 'uninitialized new' not being assignable to 'Initialized(javax.crypto.spec.IvParameterSpec)'.
WARNING:/Shadow/projects/test/plugin/general-cases/test-plugin-general-cases/build/intermediates/transforms/ShadowTransform/plugin/debug/83.jar: D8: Invalid stack map table at instruction 111: invokespecial java.util.Hashtable.(I)V, error: Could not assign '{0:Initialized(com.tencent.kona.sun.security.provider.JavaKeyStore),1:int,2:Initialized(char[]),3:Initialized(java.util.Hashtable),4:Initialized(java.security.MessageDigest),5:null,6:uninitialized new,7:int,8:int,9:Initialized(java.io.DataInputStream)}' to '{0:Initialized(java.lang.Object),1:oneword,2:Initialized(char[]),3:Initialized(java.util.Hashtable),4:Initialized(java.security.MessageDigest),5:Initialized(java.lang.Object),6:Initialized(java.util.Hashtable),7:int,8:int}'. The local at index 6 with 'uninitialized new' not being assignable to 'Initialized(java.util.Hashtable)'.
....
ERROR:/Shadow/projects/test/plugin/androidx-cases/test-plugin-androidx-cases/build/intermediates/transforms/ShadowTransform/plugin/debug/0.jar: D8: java.lang.NullPointerException: Cannot read field "d" because "" is null
.....

请问这个原因是什么导致的呢?似乎是引入的 SDK(AAR 文件中)包含了一些 class 字节码格式不合法或不兼容 D8 的类?尤其是下面这些类异常频繁:

com.tencent.kona.sun.security.ssl.SSLSessionImpl

com.tencent.kona.sun.security.ssl.HandshakeContext

com.tencent.kona.sun.security.ssl.CertStatusExtension

com.tencent.kona.sun.security.util.ObjectIdentifier

javax.crypto.spec.IvParameterSpec

我尝试了使用该issue#1196的解决方案,使用提交9ca4121的方法,但并没有解决该问题。

@shifujun

附测试demo:https://github.com/VayneXPP/Shadow/tree/issue-Invalid-stack-map-table
提交:bc31ff2

主要语言
Java
星标
7.8k
派生
1.3k
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Tencent/Shadow 的其他 Issue

查看 Tencent/Shadow 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。