Android studio gradle dx命令突然出错

时间:2016-01-05 15:02:30

标签: android gradle android-gradle multidex android-multidex

tasks.withType(Dex) { dexTask ->
    def command = [] as List
    command << '--minimal-main-dex'
    command << '--set-max-idx-number=50000'
    dexTask.setAdditionalParameters(command)
}

我从互联网上复制这段代码(例如Is there a way to limit method amount in main dex file while using MultiDex feature in Android Studio),直到昨天才这样。我也使用svn来比较两个版本的差异。(但没有任何改变,它只是不会以某种方式工作。)

gradle输出的错误是:

--minimal-main-dex is only supported in combination with --multi-dex and --main-dex-list
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>]
  [<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.
  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: a class name in internal form, like Ljava/lang/Object;
    member: 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.11).
  dx --help
    Print this message.
Error:Execution failed for task ':app:dexDevDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 1
顺便说一句,代码函数最初是将第一个DEX文件方法的最大值设置为50000。

0 个答案:

没有答案