LSPosed/LSParanoid

Debug version works well, but release version crashes.

Closed this issue · 13 comments

Debug version worked well and release version crashed with call stack:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'char java.lang.String.charAt(int)' on a null object reference
                 	at org.lsposed.lsparanoid.DeobfuscatorHelper.getCharAt(DeobfuscatorHelper.java:62)
                 	at org.lsposed.lsparanoid.DeobfuscatorHelper.getString(DeobfuscatorHelper.java:47)

I have add some proguard rules:
-keep class org.lsposed.lsparanoid.** { *; } -keepclassmembers class org.lsposed.lsparanoid.** { *; }

I use jax to decompile the apk, and find some difference from debug version and release version.
debug:

    private static final String[] chunks;

    static {
        chunks = r0;
        String[] strArr = {"\uffff¦blahblah"};
    }

    public static String getString(long j) {
        return DeobfuscatorHelper.getString(j, chunks);
    }

release:

    private static final String[] chunks;

    static {
        String[] strArr = new String[6];
        chunks = strArr;
        strArr[0] = "\uffff¦゙blahblash゙";
    }

    public static String getString(long j10) {
        return DeobfuscatorHelper.getString(j10, chunks);
    }

I don't know what's problem. Can you give me some suggestion? Thanks!

String[] strArr = new String[6];

This looks like R8's bug. We cannot fix it.

@sweord I encountered the same issue. After exploring for a while, I found that there was a super long string (13450 chars) in the obfuscated string. After removing it, everything was fine. Hope it helps you.

I have same issue.
@yujincheng08 Is it possible that changing the R8 version will solve the problem?

I guess the problem is global obfuscation, because I had no problem in single obfuscation mode, but in global obfuscation mode, the app crashed with the same error. The classes related to this mode may have been removed by R8, which needs your review.

@AlirezaIvaz I disabled global obfuscation, but there is still a problem.

@AlirezaIvaz I disabled global obfuscation, but there is still a problem.

Do you still get Attempt to invoke virtual method 'char java.lang.String.charAt(int)' on a null object reference error?
And what's your configuration? I also changed all configurations to default, maybe another config produces this problem.

why are we closing this ticket?

@choongyouqi because its bug of R8. we directly apply obfuscation on jar b4 R8's optomization, so there nothing we can do to hack R8.

@AlirezaIvaz I disabled global obfuscation, but there is still a problem.

Do you still get Attempt to invoke virtual method 'char java.lang.String.charAt(int)' on a null object reference error? And what's your configuration? I also changed all configurations to default, maybe another config produces this problem.

Yes, I get same error.
The problem is that the String array is created with several cells, but only the first cell is filled.
But in debug mode all cells filled.

@choongyouqi because its bug of R8. we directly apply obfuscation on jar b4 R8's optomization, so there nothing we can do to hack R8.

Is there a proguard rule to prevent R8 operation on LSParanoid?
Usually when we use LSParanoid we want to do obfuscation and obfuscation is done with R8. Therefore, it cannot be used.

@yujincheng08
It's fixed on Android Studio Flamingo | 2022.2.1 Patch 2 :)

I use Android Studio Flamingo | 2022.2.1 Patch 2 and Gradle 8.0.2 and android.enableR8.fullMode=false

hmm, full mode still doesnt work?

problem still exist