thexxturboxx / dex2jar Goto Github PK
View Code? Open in Web Editor NEWThis project forked from pxb1988/dex2jar
Tools to work with android .dex and java .class files
License: Apache License 2.0
This project forked from pxb1988/dex2jar
Tools to work with android .dex and java .class files
License: Apache License 2.0
The commit 1096eeb introduces a bug regarding the signature of lambda methods.
How to reproduce:
Consider this code as the content of a file named Example.kt
:
package example
fun main(args : Array<String>) {
val data = runCatching { throw Exception() }.getOrElse { "bruh" }
println(data)
}
Compile it to a .dex
file, using d8
:
$ kotlinc Example.kt -d example.jar
$ d8 example.jar 2>/dev/null
Using dex2jar-v64, the compiled dex can be converted back to a executable .jar file just fine:
$ ./dex-tools-v64/d2j-dex2jar.sh --output ok-result-v64.jar classes.dex
dex2jar classes.dex -> ok-result-v64.jar
$ kotlin -cp ok-result-v64.jar example.ExampleKt
bruh
But when using dex2jar-v65+, executing the generated jar file throws an NoSuchMethodError
error:
$ ./dex-tools-v65/d2j-dex2jar.sh --output error-result-v65.jar classes.dex
dex2jar classes.dex -> error-result-v65.jar
$ kotlin -cp error-result-v66.jar example.ExampleKt
Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.Object kotlin.Result.constructor_impl(java.lang.Object)'
at example.ExampleKt.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:70)
at org.jetbrains.kotlin.runner.Main.run(Main.kt:194)
I don't know if this only affects Kotlin lambdas, or if Java lambdas are also affected.
Java 17.0.8 / Kotlin 1.9.20
d2j-dex2jar -- convert dex to jar
usage: d2j-dex2jar [options] <file0> [file1 ... fileN]
options:
...
-os,--optmize-synchronized optimize-synchronized
-r,--reuse-reg reuse register while generate java .class file
At file dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java
line 562:
case T_DOUBLE:
return b(1, Exprs.nNewArray("D", local));
case T_LONG:
return b(1, Exprs.nNewArray("D", local));
dex2jar successfully converts the classes in my apk to a jar file.
However, while attempting to inspect those classes in a desktop application with Class.forName(name, false) (note the initialize = false arg), I see this error:
error: unable to process AboutBottomSheet.kt: Method $jacocoInit in class androidx/lifecycle/HasDefaultViewModelProviderFactory has illegal modifiers: 0xA
After some investigating, I'm guessing this corresponds to a default modifier in the HasDefaultViewModelProviderFactory interface (defined by Android):
default CreationExtras getDefaultViewModelCreationExtras() {
return CreationExtras.Empty.INSTANCE;
}
This modifier was introduced in Java 8 (52), but the Android classes are for Java 6 (50).
So I believe the error results from a newer modifier in an older class version where it was not supported.
Can someone with greater knowledge confirm this suspicion, or comment on what else might be going on?
Incidentally, I tried converting that class to level 52 with d2j-class-version-switch.sh, but the problem remains.
I use the sh d2j dex2jar. sh../classes. dex
command, The generated jar file is only 12KB. The dex file has 29M.
classes.dex
if i use openjava18. i got this error
#This file is generated by dex2jar
Please report this file to one of following link if possible (any one).
https://github.com/ThexXTURBOXx/dex2jar/issues
[email protected]
There are 1 fails.
2022-06-07 08:15:12 UTC
version: [dex-reader-null, dex-reader-api-null, dex-ir-null, d2j-smali-null, d2j-base-cmd-null, dex-tools-null, dex-translator-null]
cmdline: [--force, classes.dex]
env:
java.specification.version: 18
java.class.path: .:../dex-tools-2.1-SNAPSHOT/lib/ST4-4.3.1.jar:../dex-tools-2.1-SNAPSHOT/lib/antlr-3.5.2.jar:../dex-tools-2.1-SNAPSHOT/lib/antlr-runtime-3.5.2.jar:../dex-tools-2.1-SNAPSHOT/lib/antlr4-4.9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/antlr4-runtime-4.9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/asm-9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/asm-analysis-9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/asm-commons-9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/asm-tree-9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/asm-util-9.3.jar:../dex-tools-2.1-SNAPSHOT/lib/d2j-base-cmd-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/d2j-jasmin-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/d2j-smali-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/d8-32.0.0.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-ir-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-reader-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-reader-api-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-tools-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-translator-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dex-writer-2.1-SNAPSHOT.jar:../dex-tools-2.1-SNAPSHOT/lib/dx-30.0.3.jar:../dex-tools-2.1-SNAPSHOT/lib/icu4j-69.1.jar:../dex-tools-2.1-SNAPSHOT/lib/javax.json-1.0.4.jar:../dex-tools-2.1-SNAPSHOT/lib/org.abego.treelayout.core-1.0.3.jar
java.vm.vendor: Homebrew
java.vendor.url: https://github.com/Homebrew/homebrew-core/issues
java.vm.specification.version: 18
java.specification.vendor: Oracle Corporation
java.version.date: 2022-04-19
java.home: /usr/local/Cellar/openjdk/18.0.1/libexec/openjdk.jdk/Contents/Home
java.vm.compressedOopsMode: Zero based
java.vm.specification.vendor: Oracle Corporation
java.specification.name: Java Platform API Specification
java.runtime.version: 18.0.1+0
java.runtime.name: OpenJDK Runtime Environment
java.vm.name: OpenJDK 64-Bit Server VM
java.vendor.version: Homebrew
java.vendor.url.bug: https://github.com/Homebrew/homebrew-core/issues
java.io.tmpdir: /var/folders/2t/5kv5st7x3vqfhlvy8stqnkr40000gn/T/
java.version: 18.0.1
java.vm.specification.name: Java Virtual Machine Specification
java.library.path: /Users/nicko/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
java.vm.info: mixed mode, sharing
java.vendor: Homebrew
java.vm.version: 18.0.1+0
java.class.version: 62.0
java.lang.IndexOutOfBoundsException
at java.base/java.nio.Buffer.checkIndex(Buffer.java:746)
at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:439)
at com.googlecode.d2j.reader.DexFileReader.getString(DexFileReader.java:1029)
at com.googlecode.d2j.reader.DexFileReader.getType(DexFileReader.java:1044)
at com.googlecode.d2j.reader.DexFileReader.accept(DexFileReader.java:716)
at com.googlecode.d2j.reader.DexFileReader.accept(DexFileReader.java:690)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:47)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:246)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
dex2jar version:2.4
error:Uncaught translation error: com.android.dx.cf.code.SimException: stack: overflow
Uncaught translation error: com.android.dx.cf.code.SimException: stack: overflow
2 errors; aborting
example dex: classes.dex
dex2jar ../com.ss.android.ugc.aweme.lite.apk -> .\com.ss.android.ugc.aweme.lite-dex2jar.jar
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.(Unknown Source)
at java.lang.StringBuilder.toString(Unknown Source)
at com.googlecode.d2j.util.Mutf8.decode(Mutf8.java:42)
at com.googlecode.d2j.reader.DexFileReader.getString(DexFileReader.java:1034)
at com.googlecode.d2j.reader.DexFileReader.getType(DexFileReader.java:1044)
at com.googlecode.d2j.reader.DexFileReader.getMethod(DexFileReader.java:1022)
at com.googlecode.d2j.reader.DexFileReader.acceptInsn(DexFileReader.java:1728)
at com.googlecode.d2j.reader.DexFileReader.acceptCode(DexFileReader.java:1489)
at com.googlecode.d2j.reader.DexFileReader.acceptMethod(DexFileReader.java:1142)
at com.googlecode.d2j.reader.DexFileReader.acceptClass(DexFileReader.java:918)
at com.googlecode.d2j.reader.DexFileReader.accept(DexFileReader.java:725)
at com.googlecode.d2j.reader.MultiDexFileReader.accept(MultiDexFileReader.java:122)
at com.googlecode.d2j.reader.MultiDexFileReader.accept(MultiDexFileReader.java:115)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:48)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:235)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
Hey, currently I'm using @Lanchon version of dex2jar https://github.com/DexPatcher/dex2jar/releases/tag/v2.1-20190905-lanchon using jitpack (https://jitpack.io/#DexPatcher/dex2jar)
I wonder if you are planing to release your changes to any maven repo?
Also does your fork also have the same patches? (mainly speaking I use Dex2jar
from dex-tools
which converts apk files to jar files, and it supports up to dex version 038)
dex2jar C:\Users\RUSSIAVK\Desktop\apk\alipay_wap_main.apk -> .\alipay_wap_main-dex2jar.jar
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1AfterExitAppRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1CompleteRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1FinishAppRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1WaitActivityDestroyRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1AfterExitAppRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1FinishAppRunnable)
WARN: Ignored invalid inner-class name, treat as anonymous inner class. (1WaitActivityDestroyRunnable)
APK FILE :https://t.alipayobjects.com/L1/71/100/and/alipay_wap_main.apk
This was a painful one to track down, but this particular fork of dex2jar erases some of the inner class info when ran on a DEX file that was rewritten using dexlib2.
I have added a reproduction case in https://github.com/MikeAndrson/dex2jar/blob/main/main/src/main/java/Main.kt , it has a DEX file named classes_org.dex
, and it:
classes_org.dex
to classes_dexlib2.dex
using dexlib2,classes_org.dex
and classes_dexlib2.dex
,Main.class
files produced by both DEX files,The result is:
[DeleteDelta, position: 4, lines: [ // access flags 0x0, INNERCLASS Main$1 null null]]
Now this might seem trivial but it kinda messes with decompilers, which was a big problem for my project. So I decided to track it down and realized that this issue doesn't exist on the original dex2jar. So I checked the commits of this fork and found this one: 98196e0
I'm not sure why, but reverting the above change solves the issue.
You can try and see for yourself that the diff doesn't complain in my "revert" branch where I reverted that change: https://github.com/MikeAndrson/dex2jar/tree/revert
I'm not sure if the above change was necessary or not, but it does constitute a problem in my project 😅
I'm currently looking into Android support on my project, Recaf (rewrite work where this would apply to), and am evaluating a number of potential paths. One such path would be the following:
DexFileNode
from classes.dex
DexClassNode
instances, store in a Map<String, DexClassNode>
DexClassNode
classes.dex
by using DexFileWriter
to take the Map<String, DexClassNode>
and pack it back into classes.dex
One problem, I don't see anything to facilitate a Asm2Dex
process. If need be I'd be willing to contribute work towards making it.
If you have any thoughts on how this process could be improved I'd love to hear 'em.
I am working in a project in Scala that is using "SootUp" as a dependency.
In file build.sbt
I am trying to download "org.soot-oss" % "sootup.callgraph" % "1.1.2"
and I am getting the error:
sbt.librarymanagement.ResolveException: Error downloading com.github.ThexXTURBOXx.dex2jar:dex-tools:v61
which is pointing this repository, so I am wondering if you can help me, sir
It would be nice if the generated JAR for a given input could be deterministic. Not sure if there are more hoops to go through, but my main complaint is that certain methods' auto-generated names seem to be changing each time you generate, like this one: $d2j$hex$c51fa2bb$decode_J
If you need a reproduction case, take any YouTube APK and search the given output JAR.
dex2jar ../app.apk -> ./app-dex2jar.jar
ASM fail to generate .class file: iko/lxf
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at org.objectweb.asm.Frame.getConcreteOutputType(Frame.java:1140)
at org.objectweb.asm.Frame.merge(Frame.java:1185)
at org.objectweb.asm.CurrentFrame.execute(CurrentFrame.java:53)
at org.objectweb.asm.MethodWriter.visitVarInsn(MethodWriter.java:927)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2409)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
at org.objectweb.asm.ClassWriter.replaceAsmInstructions(ClassWriter.java:777)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:740)
at com.googlecode.d2j.dex.Dex2jar$1$1.visitEnd(Dex2jar.java:71)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:555)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:449)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:614)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:153)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:253)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
ASM fail to generate .class file: iko/oxf
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at org.objectweb.asm.Frame.getConcreteOutputType(Frame.java:1140)
at org.objectweb.asm.Frame.merge(Frame.java:1185)
at org.objectweb.asm.CurrentFrame.execute(CurrentFrame.java:53)
at org.objectweb.asm.MethodWriter.visitVarInsn(MethodWriter.java:927)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2409)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
at org.objectweb.asm.ClassWriter.replaceAsmInstructions(ClassWriter.java:777)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:740)
at com.googlecode.d2j.dex.Dex2jar$1$1.visitEnd(Dex2jar.java:71)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:555)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:449)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:614)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:153)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:253)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
Detail Error Information in File ./app-error.zip
will send apk to email
Hello, I want to use this project in my Android project, what libraries are needed, if possible, give me their names.
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:
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.
@Aliucord @js6pak @Juby210 Would you allow me to merge some of your changes to this repo, such that some of your fixes are also included in BytecodeViewer or my builds on general?
That would be very nice from you :)
I know that the Apache license doesn't forbid me to just do it, but I still want to ask people before I do such stuff (I've had a very bad interaction with another developer once for basically the same reason).
I found that your release is much bigger than pxb1988's!! I compared it to the jar. And I find that you added a jar to your release called ICU4J, which is 10M+ and takes up quite a lot of file volume.
Then I searched your entire dex2jar code project, and I couldn't find a single reference to "com.ibm." Am I to assume that this ICU4J is not actually referenced in your code?
If so, I recommend removing the ICU4J to reduce the size of the file considerably. Your downloads will definitely increase.
Of course, if you do refer to this jar, I feel that your reference to this jar is not very good. Except for ICU4J, all the others add up to about 3M, and this one jar takes up 10M. This is a serious question.
I created the jar and can read it with jd-gui but I cannot edit it.
I don't know what to do with the jar now.
I would like to be able to edit the code. I don't know Java bytecode but would be open to learn it if necessary.
Does anybody have any tips on getting started modifying the code of android apps?
I don't know where else to post it.
I tried converting it to jasmin but it fails with this error:
Exception in thread "main" java.lang.NoSuchMethodError: 'void org.objectweb.asm.util.Printer.appendString(java.lang.StringBuilder, java.lang.String)' at com.googlecode.d2j.jasmin.JasminDumper.print(JasminDumper.java:618) at com.googlecode.d2j.jasmin.JasminDumper$1.visitLdcInsn(JasminDumper.java:410) at org.objectweb.asm.tree.LdcInsnNode.accept(LdcInsnNode.java:71) at com.googlecode.d2j.jasmin.JasminDumper.dump(JasminDumper.java:296) at com.googlecode.d2j.jasmin.Jar2JasminCmd.disassemble1(Jar2JasminCmd.java:108) at com.googlecode.d2j.jasmin.Jar2JasminCmd.access$000(Jar2JasminCmd.java:21) at com.googlecode.d2j.jasmin.Jar2JasminCmd$1.visitFile(Jar2JasminCmd.java:92) at com.googlecode.d2j.jasmin.Jar2JasminCmd$1.visitFile(Jar2JasminCmd.java:88) at java.base/java.nio.file.Files.walkFileTree(Files.java:2811) at java.base/java.nio.file.Files.walkFileTree(Files.java:2882) at com.googlecode.d2j.jasmin.Jar2JasminCmd.travelFileTree(Jar2JasminCmd.java:88) at com.googlecode.d2j.jasmin.Jar2JasminCmd.disassemble0(Jar2JasminCmd.java:82) at com.googlecode.d2j.jasmin.Jar2JasminCmd.doCommandLine(Jar2JasminCmd.java:67) at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297) at com.googlecode.d2j.jasmin.Jar2JasminCmd.main(Jar2JasminCmd.java:37)
Is this even a good approach to editing the code?
I hope somebody will be able to help me
Hello @ThexXTURBOXx
We try to execute the following command in the mac OS after giving full permission results:
MacBook-Pro:$ ./d2j-dex2jar.sh -f -o /Users/Desktop/classes.jar /Users/Desktop/classes.dex
-bash: ./d2j-dex2jar.sh: /bin/sh^M: bad interpreter: No such file or directory
The above error is coming if we give the executable permission to the file "chmod +x d2j-dex2jar.sh". We like to know the reason for this problem.
if the only thing I get is an invalid or corrupt JAR file?
Any plans for supporting newer versions of dex?
Looks like dex version 039 and 040 exist now.
I'm trying to use jar2dex having the following errors:
jar2dex tmp/monitored_app-converter.apk.jar -> tmp/classes.dex
call com.android.dx.command.Main.main[--dex, --no-strict, --output=/Users/gabrielmartins/Desktop/UnB/TCC/RuntimeVerification/rv-android/beta/cli/tmp/classes.dex, --min-sdk-version=13, /Users/gabrielmartins/Desktop/UnB/TCC/RuntimeVerification/rv-android/beta/cli/tmp/monitored_app-converter.apk.jar]
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.String[] using a local variable of type androidx.activity.result.contract.ActivityResultContract. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type int[] using a local variable of type android.content.Intent. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object[] using a local variable of type java.lang.String. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.reflect.Constructor using a local variable of type java.lang.Class[]. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.io.FileOutputStream using a local variable of type java.lang.Object[]. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type int[] using a local variable of type android.content.Context. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type android.graphics.drawable.Drawable[] using a local variable of type android.graphics.drawable.Drawable. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type android.graphics.drawable.Drawable[] using a local variable of type android.graphics.drawable.Drawable. This is symptomatic of .class transformation tools that ignore local variable information.
Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.String[] using a local variable of type android.app.SearchableInfo. This is symptomatic of .class transformation tools that ignore local variable information.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:614)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:310)
at com.android.dx.command.dexer.Main.runDx(Main.java:288)
at com.android.dx.command.dexer.Main.main(Main.java:244)
at com.android.dx.command.Main.main(Main.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.googlecode.dex2jar.tools.Jar2Dex.doCommandLine(Jar2Dex.java:84)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
at com.googlecode.dex2jar.tools.Jar2Dex.main(Jar2Dex.java:14)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:606)
... 11 more
What I'm doing is using the rv-android tool to instrument an android app apk and check when the app accesses some android API.
When converting the Jar to Dex I'm having these errors.
Do you know what it could be and how to fix it?
java -jar d2j-jar2dex.sh classes_patched.jar
Error: Invalid or corrupt jarfile d2j-jar2dex.sh
JAR file is the same one dex2jar produced. How come?
Please fix the Method code too large exception
.
In this Issue comment (Which is in the main dex2jar repository) the comment explained that this exception is not necessary at all and then explained how to edit the byte code so that this exception doesn't happen anymore.
Please make it so that this exception doesn't happen by default.
Thank you.
ubuntu@fv48:~$ sh dex-tools-2.2-SNAPSHOT/d2j-dex2jar.sh pico.apk
dex2jar pico.apk -> ./pico-dex2jar.jar
GLITCH: 0004 L_a/a/_a;.<init>()V | not enough space for reading instruction
GLITCH: 000c L_/1;.<init>()V | not enough space for reading instruction
Applying workaround to method L_a/a/_a;#___a with original signature null by changing its types to java.lang.Object.
java.lang.IllegalArgumentException
at org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:213)
at org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1092)
at org.objectweb.asm.MethodWriter.<init>(MethodWriter.java:469)
at org.objectweb.asm.ClassWriter.visitMethod(ClassWriter.java:793)
at org.objectweb.asm.ClassVisitor.visitMethod(ClassVisitor.java:305)
at org.objectweb.asm.commons.RemappingClassAdapter.visitMethod(RemappingClassAdapter.java:99)
at org.objectweb.asm.ClassVisitor.visitMethod(ClassVisitor.java:305)
at com.googlecode.d2j.dex.Dex2Asm.collectBasicMethodInfo(Dex2Asm.java:285)
at com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:611)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:469)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:380)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:508)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:180)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:280)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:112)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:33)
ubuntu@fv48:~$ java --version
openjdk 11.0.16.1 2022-08-12
OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.16.1+1 (build 11.0.16.1+1, mixed mode)
apk file: https://cdn.discordapp.com/attachments/757985854588190731/1014526587410075708/vr-_01.20.00.apk
i tried to convert dex -> java but it showed these errors^
it didn't work on pxb1988's dex2jar too.
i dont know about this as well, but is it possible to fix?
I have this apk: tachiyomi-zh.copymanga-v1.3.48.zip
The contents are:
$ unzip tachiyomi-zh.copymanga-v1.3.48.apk
Archive: tachiyomi-zh.copymanga-v1.3.48.apk
inflating: META-INF/com/android/build/gradle/app-metadata.properties
inflating: classes.dex
inflating: kotlin-tooling-metadata.json
inflating: simp.txt
inflating: simplified.txt
inflating: AndroidManifest.xml
extracting: res/CG.png
extracting: res/D2.png
extracting: res/SD.png
extracting: res/jy.png
extracting: res/u3.png
extracting: resources.arsc
inflating: META-INF/CERT.SF
inflating: META-INF/CERT.RSA
inflating: META-INF/MANIFEST.MF
Part of the code inside the apk is using this library: https://github.com/luhuiguo/chinese-utils/blob/master/src/main/java/com/luhuiguo/chinese/Converter.java#L49 and the stacktrace is available at Suwayomi/Suwayomi-Server#512 (comment)
That library requires to load resource file /simp.txt
or /simplified.txt
but these are not included in the converted jar.
We are converting dex2jar via this function: https://github.com/Suwayomi/Tachidesk-Server/blob/master/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/PackageTools.kt#L53
Is there something we can do to make dex2jar include non-class files as well?
Pretty simple, however useful for later decompilation with something like quiltflower
There are some error log about fastjson
haluo-error.zip
apk file :https://wap.pp.cn/app/dl/fs08/2021/08/23/5/106_6b852528162327c9f056dd40f2ce9ce7.apk
Hello @ThexXTURBOXx
When we try to use https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.9.3 in the apk. It results in following error.
Process: com.sampleapp, PID: 13211
java.lang.NoClassDefFoundError: Failed resolution of: Lres/Hex;
at okhttp3.internal.http2.Huffman.$d2j$hex$c61541e3$decode_I(Unknown Source:16)
at okhttp3.internal.http2.Huffman.(Unknown Source:17)
at okhttp3.internal.http2.Hpack$Writer.writeByteString(Unknown Source:11)
at okhttp3.internal.http2.Hpack$Writer.writeHeaders(Unknown Source:264)
at okhttp3.internal.http2.Http2Writer.headers(Unknown Source:12)
at okhttp3.internal.http2.Http2Connection.newStream(Unknown Source:82)
at okhttp3.internal.http2.Http2Connection.newStream(Unknown Source:6)
at okhttp3.internal.http2.Http2ExchangeCodec.writeRequestHeaders(Unknown Source:25)
at okhttp3.internal.connection.Exchange.writeRequestHeaders(Unknown Source:16)
at okhttp3.internal.http.CallServerInterceptor.intercept(Unknown Source:29)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.connection.ConnectInterceptor.intercept(Unknown Source:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.cache.CacheInterceptor.intercept(Unknown Source:192)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.http.BridgeInterceptor.intercept(Unknown Source:171)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(Unknown Source:37)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(Unknown Source:119)
at okhttp3.internal.connection.RealCall.execute(Unknown Source:27)
How we are calling the OkHttpClient from code: The problem is with 4.x.x http library
private static final String URL_STRING = "https://www.google.com/";
private void okHttpLib()
{
try {
new Thread(new Runnable()
{
@OverRide
public void run()
{
try {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(URL_STRING)
.build();
Response response = client.newCall(request).execute();
Log.i(LOG_TAG, "OK HTTP, " + URL_STRING + ", status code: " + response.code());
response.body().string();
}
catch (Exception e) {
Log.e(LOG_TAG, "Exception while making okhttp call");
}
}
}).start();
}
catch (Exception e) {
Log.e(LOG_TAG, "Exception", e);
}
}
Can you please check this issue?
Got this error when decompiling APK
Hello,
When I decompile it with the dex2jar.sh and try to open it in my java editor (Intellij IDEA) it doesn't open any ideas on how I can fix that?
Kind regards
Hello,
Is there any plan to support Kotlin features here. With current code, when we try to use dex to jar , most of the files are getting skipped and in the final jar kotlin classes are missed out or compiling incorrectly.
I would like to know about dex-ir. Do you have any relevant documents? If available, please provide one copy. Thank you!
My email: [email protected]
From what I've observed, you like to use a generic version to manage releases, which creates a problem. It is this version of "vNum" that is not loved by programmers.
As programmers, we are more familiar with using the SemVer. Isn't that right?
So, I feel that release can also use this semantic version, with just a few minor changes. For example, v73 -> 0.7.3. It's simple, and it looks pretty standard.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.