insomnia1232
V2EX  ›  Android

Android 中怎么在不使用反射不重打包的情况下修改第三方库的实现?

  •  
  •   insomnia1232 · Jul 19, 2019 · 12950 views
    This topic created in 2507 days ago, the information mentioned may be changed or developed.

    假如依赖了一个第三方的 aar,想修改里面某个类的实现,不拆包重打包或者用反射的话怎么做呢?用 classloader 可以实现吗?

    4 replies    2019-07-20 20:21:46 +08:00
    shily
        1
    shily  
       Jul 20, 2019 via Android
    看需求吧,插桩可以试试 Hibeaver
    wsxyeah
        2
    wsxyeah  
       Jul 20, 2019
    Transform api?
    guyeu
        3
    guyeu  
       Jul 20, 2019
    不可能。。。字节码代理也好,重加载类也好,本质上都是基于反射的。
    insomnia1232
        4
    insomnia1232  
    OP
       Jul 20, 2019
    @guyeu 面试被问到这个问题 应该是和热修复相关的东西?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1642 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 16:23 · PVG 00:23 · LAX 09:23 · JFK 12:23
    ♥ Do have faith in what you're doing.