Android Plugin DSL Reference 参考文档 :
一、DexOptions#additionalParameters 属性配置
BaseExtension 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.BaseExtension.html
1、DexOptions#additionalParameters 属性配置简介
DexOptions#additionalParameters 属性配置 用于 配置 dx 工具的 附加参数 ;
执行构建打包的过程中 , 会自动在使用 dx 工具打包 .dex 字节码文件时 , 使用这些附件参数 ;
2、DexOptions#additionalParameters 属性配置原型
DexOptions#additionalParameters 属性配置原型 : 该配置类型是 List<String> 类型 , 在 Groovy 语法中 , 使用多个字符串用逗号隔开即可 ;
List<String> additionalParameters
List of additional parameters to be passed to dx.
3、dx 工具
dx 工具是 dex 文件打包工具 , 用于将 .class 字节码文件打包成 .dex 字节码文件 ,
apk 文件中的 classes.dex 就是打包后的 .dex 字节码文件 ;
dx 工具位置处于 SDK 根目录下的 " build-tools\版本号\dx.exe " 位置 ;
示例 : Windows 中 , dx 工具位置 " D:\001_Develop\001_SDK\Sdk\build-tools\30.0.3\dx.exe " ;
4、dx 附加参数
dx 工具的附加参数可以通过执行
dx --help
命令查看附加参数信息 , 完整命令行输出如下 :
D:\002_Project\002_Android_Learn\ClassLoader_Demo>dx --help
usage:
dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals]
[--no-optimize] [--statistics] [--[no-]optimize-list=<file>] [--no-strict]
[--keep-classes] [--output=<file>] [--dump-to=<file>] [--dump-width=<n>]
[--dump-method=<name>[*]] [--verbose-dump] [--no-files] [--core-library]
[--num-threads=<n>] [--incremental] [--force-jumbo] [--no-warning]
[--multi-dex [--main-dex-list=<file> [--minimal-main-dex]]
[--input-list=<file>] [--min-sdk-version=<n>]
[--allow-all-interface-method-invokes]
[<file>.class | <file>.{zip,jar,apk} | <directory>] ...
Convert a set of classfiles into a dex file, optionally embedded in a
jar/zip. Output name must end with one of: .dex .jar .zip .apk or be a
directory.
Positions options: none, important, lines.
--multi-dex: allows to generate several dex files if needed. This option is
exclusive with --incremental, causes --num-threads to be ignored and only
supports folder or archive output.
--main-dex-list=<file>: <file> is a list of class file names, classes
defined by those class files are put in classes.dex.
--minimal-main-dex: only classes selected by --main-dex-list are to be put
in the main dex.
--input-list: <file> is a list of inputs.
Each line in <file> must end with one of: .class .jar .zip .apk or be a
directory.
--min-sdk-version=<n>: Enable dex file features that require at least sdk
version <n>.
dx --annotool --annotation=<class> [--element=<element types>]
[--print=<print types>]
dx --dump [--debug] [--strict] [--bytes] [--optimize]
[--basic-blocks | --rop-blocks | --ssa-blocks | --dot] [--ssa-step=<step>]
[--width=<n>] [<file>.class | <file>.txt] ...
Dump classfiles, or transformations thereof, in a human-oriented format.
dx --find-usages <file.dex> <declaring type> <member>
Find references and declarations to a field or method.
<declaring type> is a class name in internal form, like Ljava/lang/Object;
<member> is a field or method name, like hashCode.
dx -J<option> ... <arguments, in one of the above forms>
Pass VM-specific options to the virtual machine that runs dx.
dx --version
Print the version of this tool (1.16).
dx --help
Print this message.
|