ThexXTURBOXx / dex2jar

Tools to work with android .dex and java .class files
Apache License 2.0
234 stars 59 forks source link

[BUG] The jar has problems after decompilation. #27

Closed zhongqingsong closed 10 months ago

zhongqingsong commented 2 years ago

Decompiled an apk to get a jar. After running, it was found to crash all the time. Finally, it was found that the decompiled app jar error. You can see "-I" changed to "_I". It's not right. Below show: image

The origin code: image

I know, we can change smali file to fix. But let me just mention that. It would be nice to have a tool that can fix that.

ThexXTURBOXx commented 2 years ago

Thanks for reporting that! Could you please share the original APK/DEX file?

zhongqingsong commented 2 years ago

dexs.zip hello, this is dex file. APK too big, so I zip dex.

Thanks for reporting that! Could you please share the original APK/DEX file?

ThexXTURBOXx commented 2 years ago

Thanks for sharing. I will see what I can do about it soon

Syer10 commented 1 year ago

@ThexXTURBOXx My application has also starting receiving this issue. We have a lot of users so a fix would be appreciated.

Actual method: public static final long kotlin.time.Duration.getInWholeMilliseconds-impl(long)

Error:

java.util.concurrent.CompletionException: java.lang.NoSuchMethodError: 'long kotlin.time.Duration.getInWholeMilliseconds_impl(long)'
Caused by: java.lang.NoSuchMethodError: 'long kotlin.time.Duration.getInWholeMilliseconds_impl(long)'
    at eu.kanade.tachiyomi.extension.all.mangadex.MDConstants.<clinit>(Unknown Source)
    at eu.kanade.tachiyomi.extension.all.mangadex.MangaDex.sanitizeExistingUuidPrefs(Unknown Source)
    at eu.kanade.tachiyomi.extension.all.mangadex.MangaDex.<init>(Unknown Source)
    at eu.kanade.tachiyomi.extension.all.mangadex.MangaDex.<init>(Unknown Source)
    at eu.kanade.tachiyomi.extension.all.mangadex.MangaDexEnglish.<init>(Unknown Source)
    at eu.kanade.tachiyomi.extension.all.mangadex.MangaDexFactory.createSources(Unknown Source)
    at suwayomi.tachidesk.manga.impl.extension.Extension.installAPK(Extension.kt:161)
    at suwayomi.tachidesk.manga.impl.extension.Extension$installAPK$1.invokeSuspend(Extension.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    ... 7 common frames omitted

File: tachiyomi-all.mangadex-v1.4.189.zip

Edit: Was able to workaround the issue with this one method using ASM to fix the reference, hopefully it doesn't happen with other methods.

ThexXTURBOXx commented 1 year ago

I thought I had fixed that already. Are you using the newest version of my fork? Also, can you share an example APK/DEX file? Perhaps if needed, you can also share it via my private email

Syer10 commented 1 year ago

We are on v74, someone did some testing and its happening with every version above v64, I shared the apk above. https://github.com/ThexXTURBOXx/dex2jar/files/12910973/tachiyomi-all.mangadex-v1.4.189.zip

ThexXTURBOXx commented 1 year ago

Oh sorry, did not see that first! You said it does not work with every version above v64. Have you tried versions below (and including) v64? I would imagine it also does not work there either, right?

Syer10 commented 1 year ago

It works fine on v64, but every version after it has this issue

ThexXTURBOXx commented 1 year ago

I see what is the problem: The new fixName function rigorously renames functions without checking for their existence. Since the function you are referring to is built-in, we should not replace it. Not an easy fix, but I will hopefully be able to take a look at it soon

Syer10 commented 1 year ago

I am going to revert to v64 for now, I'll keep watching this issue for updates

ThexXTURBOXx commented 10 months ago

I have deployed a temporary fix for this issue which is available as part of 2.4.10. If you need a fix, you need to set the parameter dont sanitize names. However, be aware that this could lead to other incorrect behaviour regarding lambda expressions. A proper fix is probably impossible, but this will do for now.