APKEditor icon indicating copy to clipboard operation
APKEditor copied to clipboard

Cannot invoke "com.reandroid.arsc.value.Entry.isScalar()" because "item" is null

Open SchrodingersNeko749 opened this issue 1 year ago • 2 comments

Describe the bug Running APKEditor with any of the options in any modes besides info generates a NullPointerException in the main thread almost immediately.

To Reproduce Steps to reproduce the behavior:

  1. Used version 'APKEditor-1.4.1.'
  2. Operating system 'Windows 10'
  3. Command 'java -jar APKEditor-1.4.1.jar d -i .\myapp.apk' However using all options this still fails

Log/Stacktrace

java.lang.NullPointerException: Cannot invoke "com.reandroid.arsc.value.Entry.isScalar()" because "item" is null
        at com.reandroid.apk.ApkModule.lambda$filterResFileEntries$1(ApkModule.java:648)
        at com.reandroid.arsc.item.StringItem.lambda$getUsers$0(StringItem.java:77)
        at com.reandroid.utils.collection.ComputeIterator.getNext(ComputeIterator.java:52)
        at com.reandroid.utils.collection.ComputeIterator.hasNext(ComputeIterator.java:38)
        at com.reandroid.utils.collection.CollectionUtil.toList(CollectionUtil.java:180)
        at com.reandroid.apk.ApkModule.filterResFileEntries(ApkModule.java:657)
        at com.reandroid.apk.ApkModule.listResFiles(ApkModule.java:595)
        at com.reandroid.apk.ApkModule.listResFiles(ApkModule.java:581)
        at com.reandroid.apkeditor.protect.DirectoryConfuser.confuse(DirectoryConfuser.java:44)
        at com.reandroid.apkeditor.protect.Protector.runCommand(Protector.java:59)
        at com.reandroid.apkeditor.Options.runCommand(Options.java:59)
        at com.reandroid.apkeditor.Main.run(Main.java:136)
        at com.reandroid.apkeditor.Main.execute(Main.java:72)
        at com.reandroid.apkeditor.Main.main(Main.java:57)

Used apk file I Cannot disclose the name of the app due to NDA contract. but this app is a real piece of work with multiple layers of obfuscation.

Additional context apktool can decompile this but fails to recompile because of the DUMMY VALUE in the assets and the obfuscated resources. (this is my best guess so far).

SchrodingersNeko749 avatar Dec 07 '24 07:12 SchrodingersNeko749

I believe this issue is already fixed on this Commit, try with latest build from here

REAndroid avatar Dec 07 '24 14:12 REAndroid

Thanks a lot, using the new commit I was able to both decompile and recompile the app. Can you summarize how you bypass the resource obfuscation issue? I have tried everything and failed.

SchrodingersNeko749 avatar Dec 08 '24 06:12 SchrodingersNeko749