Code Monkey home page Code Monkey logo

Comments (8)

shifujun avatar shifujun commented on June 11, 2024

按照这个描述,应该没能排除是“神策plugin”先把类改坏了的情况。你可以先只应用shadow plugin测试一下。

类似的情况在业务中见过。有的字节码编辑plugin采用了asm工具,编辑时不像javassist一样验证类的合法性。

如果是shadow的问题,instrument transform的实际作用不大,建议自己多研究下怎么兼容。我这边最近不太方便调试,只有手机用。

from shadow.

Jerricc avatar Jerricc commented on June 11, 2024

只应用shadow plugin就没问题,这个类不是Android的四大组件,编译过程中是否可以忽略这个错误,遇到这个exception继续执行呢?

from shadow.

shifujun avatar shifujun commented on June 11, 2024

忽略对某些类的处理在通用的方案上肯定是不可行的。但我相信确实存在一些类或部分代码在运行时是无用的,它们被忽略掉是没关系的。但这就要你自己二次开发了。

不过看起来问题不在shadow这,那坏掉的class在转dex时可能也有问题,proguard也不见得能放过去。如果忽略真的可行的话,也许你应该考虑从第三方库的jar中,在源头上,直接删掉有问题的类。

from shadow.

Jerricc avatar Jerricc commented on June 11, 2024

好的谢谢,我再想想处理办法

from shadow.

hymlv avatar hymlv commented on June 11, 2024

好的谢谢,我再想想处理办法
最近阿里互动直播SDK也存在这个问题 java.lang.RuntimeException: javassist.CannotCompileException: by javassist.bytecode.BadBytecode: (Lcom/alivc/rtc/e/b$g;Landroid/content/Context;)V in com.alivc.rtc.e.b: inconsistent stack height Index 12 out of bounds for length 12
请问有解决方案么?

from shadow.

Jerricc avatar Jerricc commented on June 11, 2024

两种方法:
1.先让shadow plugin处理,再让其他三方plugin处理,这样有风险,如果三方plugin新增了context相关的方法那就 寄
2.三方plugin提供黑白名单,可以声明对那些类不做处理(目前我是这么解决的)

from shadow.

hymlv avatar hymlv commented on June 11, 2024

大佬,黑白名单在哪里配置呢?

from shadow.

Jerricc avatar Jerricc commented on June 11, 2024

需要先查出来是哪个gradle plugin搞坏了类,然后由对应的gradle plugin提供黑白名单,在transform阶段不去处理黑白名单的类才行

from shadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.