Tencent / tinker

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.
Other
17.1k stars 3.33k forks source link

tinker with coreLibraryDesugaring #1554

Closed andrew-ld closed 2 years ago

andrew-ld commented 3 years ago

tinker version: 1.9.14.15 gradle version: 6.8.3 compile sdk version: 30 bugly sdk: no

problem: I'm trying to activate the coreLibraryDesugaring using 'com.android.tools:desugar_jdk_libs:1.1.5', the compilation and the execution of the application works, but it's not possible to build the patches.

build log: https://gist.github.com/andrew-ld/e968228b91fe47e234369a3a4de9ee60

note: in the first dex i didn't exceed 64k methods, apparently core desugaring classes must go in another dex, in fact without multidex it's impossible to use it. (

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> In order to use core library desugaring, please enable multidex.

)

edit: the classes that have the package starting with j$ must be in a dex where there are only classes that have j$ if this condition is not verified r8 refuses to merge the classes in the dex

andrew-ld commented 3 years ago

@tomystang https://github.com/andrew-ld/tinker/commit/2d0b4ee95e9f18e7a7cb972d658ec6ffcc293333

on android versions that support native multidex this workaround seems to work, basically ignoring classloader control for desugaring classes.

the patch compiles and seems to work

andrew-ld commented 2 years ago

@tomystang finally fixed with https://github.com/Tencent/tinker/commit/0e583ff671bdf773d24a6ed9542b6d59d7fca2d2

huazidev commented 2 years ago

@tomystang finally fixed with 0e583ff

which version?