[英]How to determine which dx/d8 version was used for apk creation?
How to determine which dex compiler (dx/d8) version+flags were used in creating my apk?如何确定在创建我的 apk 时使用了哪个 dex 编译器(dx/d8) 版本+标志?
$ wget https://github.com/federicoiosue/Omni-Notes/releases/download/6.0.5/6.0.5.apk
$ cat extract_dex_compiler.py
from androguard.misc import AnalyzeAPK
a,d,dx=AnalyzeAPK("6.0.5.apk")
print(a.get_androidversion_code())
$ python3.7 extract_dex_compiler.py > android.xml && sed "s/\\\\n/\n/g" android.xml | grep "version"
Then I get the following details:然后我得到以下详细信息:
b'<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="280" android:versionName="6.0.5" package="it.feio.android.omninotes">
<meta-data android:name="com.google.android.gms.version" android:value="@7F0A000B"/>
So this means that cmdline-tools/build-tools/28.0.0/dx
was used???所以这意味着使用了
cmdline-tools/build-tools/28.0.0/dx
???
When a DEX file is compiled with D8 and R8 a special marker string in added to the DEX file string pool.当使用 D8 和 R8 编译 DEX 文件时,会在 DEX 文件字符串池中添加一个特殊的标记字符串。 This string is prefixed by
~~D8
, ~~R8
or ~~L8
depending on the tool used to create the DEX file.该字符串以
~~D8
、 ~~R8
或~~L8
为前缀,具体取决于用于创建 DEX 文件的工具。 If multiple tools where used there can be multiple markers.如果使用多个工具,则可以有多个标记。 This string is not references anywhere, so some tools will not show it.
该字符串在任何地方都没有引用,因此某些工具不会显示它。 As part of D8/R8 there is a tool to extract this marker from either an APK (from the
classes.dex
in that APK) or from a DEX file.作为 D8/R8 的一部分,有一个工具可以从 APK(从该 APK 中的
classes.dex
)或 DEX 文件中提取此标记。
r8.jar
.r8.jar
。 It can be downloaded from https://maven.google.com/web/index.html#com.android.tools:r8 .$ANDROID_HOME/cmdline-tools/latest/lib/r8.jar
.$ANDROID_HOME/cmdline-tools/latest/lib/r8.jar
。java -cp r8.jar com.android.tools.r8.ExtractMarker <APK or DEX file>
If the DEX is compiled with DX there is no marker present, and no simple way of finding out which version of DX was used.如果 DEX 是用 DX 编译的,则没有标记存在,也没有简单的方法可以找出使用了哪个版本的 DX。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.