skylot / jadx

Dex to Java decompiler
Apache License 2.0
42.04k stars 4.9k forks source link

Jadx throws exception: UnsupportedOperationException("Method not decompiled") #682

Closed yosradirgham closed 5 years ago

yosradirgham commented 5 years ago

I am using the latest version (v 0.9.0) of Jadx to decompile the following apk file

Jadx doesn't decompile all the functions, for some functions I get this:

 /*  JADX ERROR: JadxRuntimeException in pass: BlockProcessor
        jadx.core.utils.exceptions.JadxRuntimeException: Can't find immediate dominator for block B:61:0x00d7 in {5, 7, 13, 14, 22, 31, 32, 33, 41, 42, 43, 45, 46, 47, 48, 49, 51, 53, 57, 58, 60} preds:[]
            at jadx.core.dex.visitors.blocksmaker.BlockProcessor.computeDominators(BlockProcessor.java:242)
            at jadx.core.dex.visitors.blocksmaker.BlockProcessor.processBlocksTree(BlockProcessor.java:52)
            at jadx.core.dex.visitors.blocksmaker.BlockProcessor.visit(BlockProcessor.java:42)
            at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:27)
            at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:14)
            at java.util.ArrayList.forEach(ArrayList.java:1257)
            at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:14)
            at jadx.core.ProcessClass.process(ProcessClass.java:32)
            at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51)
            at java.lang.Iterable.forEach(Iterable.java:75)
            at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51)
            at jadx.core.ProcessClass.process(ProcessClass.java:37)
            at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292)
            at jadx.api.JavaClass.decompile(JavaClass.java:62)
            at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200)
*/

private defpackage.dmw a(defpackage.dzy r3, defpackage.efb r4, defpackage.dve r5, java.lang.String r6, defpackage.dmx r7, android.content.Context r8) {
        /*
        r2 = this;
        if (r7 == 0) goto L_0x00cf;
        r0 = r7.a();
        if (r0 == 0) goto L_0x0017;
        r0 = r7.b();
        if (r0 == 0) goto L_0x000f;
        goto L_0x0017;
        r3 = new java.lang.IllegalArgumentException;
        r4 = "Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead.";
        r3.<init>(r4);
        throw r3;
        if (r6 == 0) goto L_0x0037;
        r0 = r5;
        r0 = (defpackage.duz) r0;
        r0 = r0.a;
        if (r0 == 0) goto L_0x0032;
        r0 = "Content-Type";
        r0 = r5.a(r0);
        if (r0 == 0) goto L_0x0032;
        r6 = a;
        r0 = "AsyncHttpClient";
        r1 = "Passed contentType will be ignored because HttpEntity sets content type";
        r6.c(r0, r1);
        goto L_0x0037;
        r0 = "Content-Type";
        r5.b(r0, r6);
        r6 = r5.e();
        r7.a(r6);
        r6 = r5.k();
        r7.a(r6);
        r6 = new dmp;
        r6.<init>(r3, r4, r5, r7);
        r3 = r2.i;
        r3.submit(r6);
        r3 = new dmw;
        r3.<init>(r6);
        if (r8 == 0) goto L_0x00ce;
        r4 = r2.d;
        monitor-enter(r4);
        r5 = r2.d;   Catch:{ all -> 0x00cb }
        r5 = r5.get(r8);     Catch:{ all -> 0x00cb }
        r5 = (java.util.List) r5;    Catch:{ all -> 0x00cb }
        if (r5 != 0) goto L_0x0071;  Catch:{ all -> 0x00cb }
        r5 = new java.util.LinkedList;   Catch:{ all -> 0x00cb }
        r5.<init>();     Catch:{ all -> 0x00cb }
        r5 = java.util.Collections.synchronizedList(r5);     Catch:{ all -> 0x00cb }
        r6 = r2.d;   Catch:{ all -> 0x00cb }
        r6.put(r8, r5);  Catch:{ all -> 0x00cb }
        monitor-exit(r4);    Catch:{ all -> 0x00cb }
        r5.add(r3);
        r4 = r5.iterator();
        r5 = r4.hasNext();
        if (r5 == 0) goto L_0x00ce;
        r5 = r4.next();
        r5 = (defpackage.dmw) r5;
        r6 = r5.a;
        r6 = r6.get();
        r6 = (defpackage.dmp) r6;
        r7 = 0;
        r8 = 1;
        if (r6 == 0) goto L_0x009a;
        r6 = r6.a();
        if (r6 == 0) goto L_0x0098;
        goto L_0x009a;
        r6 = 0;
        goto L_0x009b;
        r6 = 1;
        if (r6 != 0) goto L_0x00bd;
        r6 = r5.a;
        r6 = r6.get();
        r6 = (defpackage.dmp) r6;
        if (r6 == 0) goto L_0x00ba;
        r0 = r6.a();
        if (r0 != 0) goto L_0x00b4;
        r6 = r6.a;
        if (r6 == 0) goto L_0x00b2;
        goto L_0x00b4;
        r6 = 0;
        goto L_0x00b5;
        r6 = 1;
        if (r6 == 0) goto L_0x00b8;
        goto L_0x00ba;
        r6 = 0;
        goto L_0x00bb;
        r6 = 1;
        if (r6 == 0) goto L_0x00be;
        r7 = 1;
        if (r7 == 0) goto L_0x00c5;
        r5 = r5.a;
        r5.clear();
        if (r7 == 0) goto L_0x0079;
        r4.remove();
        goto L_0x0079;
        r3 = move-exception;
        monitor-exit(r4);    Catch:{ all -> 0x00cb }
        throw r3;
        return r3;
        r3 = new java.lang.IllegalArgumentException;
        r4 = "ResponseHandler must not be null";
        r3.<init>(r4);
        throw r3;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.dmo.a(dzy, efb, dve, java.lang.String, dmx, android.content.Context):dmw");
    }

As mentioned on this issue this would work with option --show-bad-code, which didn't work for me and I still get the same exception!

I would appreciate some help with this! Thanks.

jpstotz commented 5 years ago

The code has monitor-enter / monitor-exit statements (on Java code level this is equivalent to a synchronized block). Android has some strange requirements on monitor-enter / monitor-exit calls as I highlighted in #659. Therefore most likely this is a duplicate of of #659.

skylot commented 5 years ago

@yosradirgham please check latest unstable build, it works for me. Although your link download apk with different version, so class and method have differents names: defpackage.cze.b(dnv dnv, dsz dsz, diz diz, String str, czp czp, Context context).

yosradirgham commented 5 years ago

Still not working for me, @skylot can you please tell what is the command that you run in the terminal. I run $ jadx --show-bad-code /path_to the_apk

john-amado commented 4 years ago

你好,我打开选项,把“显示不一致的代码” 改为选中就可以了。你也可以尝试一下

Translation by Google:

Hello, I open the option and change the "Display inconsistent code" to selected. You can also try

john-amado commented 4 years ago

我的版本是1.1.0

Translation by Google:

My version is 1.1.0

GodManRui commented 4 years ago

你好,我打开选项,把“显示不一致的代码” 改为选中就可以了。你也可以尝试一下

感谢大哥,大哥喝可乐!

aos5 commented 1 year ago

你好,我打开选项,把“显示不一致的代码” 改为选中就可以了。你也可以尝试一下

Translation by Google:

Hello, I open the option and change the "Display inconsistent code" to selected. You can also try

大哥吃鸡腿,感谢大哥