DexPatcher / dex2jar

Unofficial dex2jar builds
https://dexpatcher.github.io/
Apache License 2.0
209 stars 29 forks source link

[dex2jar] symbol "-" change to "_" #1

Closed ljx88714449 closed 5 years ago

ljx88714449 commented 5 years ago

com.google.android.gms:play-services-auth:16.0.1 , when I use this in my dex file , and i want to dex2jar the dex file, it will change com.google.android.gms.internal.auth-api to com.google.android.gms.internal.auth_api

Lanchon commented 5 years ago

package names in java cannot contain hyphens:

"In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen" https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

java package names consist of java identifiers: https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.4.1

and java identifiers cannot contain hyphens: https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.8

that's for the java language.

but hyphens are legal in java bytecode: "An unqualified name must contain at least one Unicode code point and must not contain any of the ASCII characters . ; [ / (that is, period or semicolon or left square bracket or forward slash)." https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.2

the presence of a hyphen in com.google.android.gms.internal.auth-api, though bytecode-legal, means that code obfuscated. dex2jar should not change the package name. but dex2jar is a can of worms: it is full of edge cases on which it doesn't work. you can ask the original project author to fix this, but he probably won't, as he is mostly missing in action. i won't fix it either: dex2jar should be rewritten from the ground up IMHO, and i don't have the time.

why do you care about this anyway? dex2jar is not good enough to translate obfuscated code and keep it runnable, so the result is only informative. so why is the - to _ conversion a problem for you?

you can try to use enjarify instead if your code is DEX version 035: https://github.com/Storyyeller/enjarify#why-not-dex2jar

but in your case, the original java bytecode is available so you don't need to translate it at all: https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-auth/16.0.1/play-services-auth-16.0.1.aar