JesusFreke / smali

smali/baksmali
6.29k stars 1.07k forks source link

Not able to run baksmali/smali on android devices #813

Open dtrunk90 opened 3 years ago

dtrunk90 commented 3 years ago

I'm trying to build a Magisk module but running baksmali directly on the device returns the following exception:

- Decompiling /data/adb/modules_update/BluetoothDeviceClassEditor/backup/Settings/classes.dex to /dev/tmp/BluetoothDeviceClassEditor/Settings/classout
Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.BootstrapMethodError: Exception from call site #5 bootstrap method
    at org.jf.baksmali.Baksmali.disassembleDexFile(Baksmali.java:92)
    at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:183)
    at org.jf.baksmali.Main.main(Main.java:102)
Caused by: java.util.concurrent.ExecutionException: java.lang.BootstrapMethodError: Exception from call site #5 bootstrap method
    at java.util.concurrent.FutureTask.report(FutureTask.java:123)
    at java.util.concurrent.FutureTask.get(FutureTask.java:193)
    at org.jf.baksmali.Baksmali.disassembleDexFile(Baksmali.java:86)
    ... 2 more
Caused by: java.lang.BootstrapMethodError: Exception from call site #5 bootstrap method
    at org.jf.baksmali.Adaptors.Format.InstructionMethodItem.writeTo(InstructionMethodItem.java:108)
    at org.jf.baksmali.Adaptors.MethodDefinition.writeTo(MethodDefinition.java:226)
    at org.jf.baksmali.Adaptors.ClassDefinition.writeDirectMethods(ClassDefinition.java:279)
    at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:114)
    at org.jf.baksmali.Baksmali.disassembleClass(Baksmali.java:161)
    at org.jf.baksmali.Baksmali.access$000(Baksmali.java:46)
    at org.jf.baksmali.Baksmali$1.call(Baksmali.java:76)
    at org.jf.baksmali.Baksmali$1.call(Baksmali.java:74)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassCastException: Bootstrap method returned null
    ... 12 more

Here's the code how I'm trying to execute baksmali: https://github.com/TeamJCD/BluetoothDeviceClassEditorMagisk/blob/main/customize.sh#L17

Same happens when executing the command using adb shell.

I've downloaded baksmali 2.5.2 and converted it into a dexed jar with dx --dex --output=baksmali-2.5.2-dexed.jar --min-sdk-version 26 baksmali-2.5.2.jar and for smali 2.5.2 respectively dx --dex --output=smali-2.5.2-dexed.jar --min-sdk-version 26 smali-2.5.2.jar

ROM: LineageOS 18.1 on Samsung Galaxy S5 (klte)