7
[2013-11-13 18:39:09 - XlApp] Dx 
trouble writing output: Too many method references: 66024; max is 65536.
You may try using --multi-dex option.
References by package:
    13 java.lang
     1 java.lang.reflect
     5 java.util
     1 javax.xml.namespace
    66 org.apache.xmlbeans
    19 org.apache.xmlbeans.impl.values
     1 org.apache.xmlbeans.impl.xb.xmlschema
  2500 org.openxmlformats.schemas.drawingml.x2006.chart
  1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
  8767 org.openxmlformats.schemas.drawingml.x2006.main
  5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
    86 org.openxmlformats.schemas.drawingml.x2006.picture
    33 org.openxmlformats.schemas.drawingml.x2006.picture.impl
   745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing
   417 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl
   230 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing
   164 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl
   298 org.openxmlformats.schemas.officeDocument.x2006.customProperties
   256 org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl
   617 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes
   596 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl
   285 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties
   196 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl
    23 org.openxmlformats.schemas.officeDocument.x2006.math
    24 org.openxmlformats.schemas.officeDocument.x2006.relationships
     2 org.openxmlformats.schemas.officeDocument.x2006.relationships.impl
  2076 org.openxmlformats.schemas.presentationml.x2006.main
  1224 org.openxmlformats.schemas.presentationml.x2006.main.impl
     1 org.openxmlformats.schemas.schemaLibrary.x2006.main
  7271 org.openxmlformats.schemas.spreadsheetml.x2006.main
  4556 org.openxmlformats.schemas.spreadsheetml.x2006.main.impl
 11448 org.openxmlformats.schemas.wordprocessingml.x2006.main
  9217 org.openxmlformats.schemas.wordprocessingml.x2006.main.impl
     4 schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707
  1170 schemasMicrosoftComOfficeExcel
  1223 schemasMicrosoftComOfficeExcel.impl
   285 schemasMicrosoftComOfficeOffice
   124 schemasMicrosoftComOfficeOffice.impl
     2 schemasMicrosoftComOfficePowerpoint
     3 schemasMicrosoftComOfficeWord
  2858 schemasMicrosoftComVml
  2529 schemasMicrosoftComVml.impl
[2013-11-13 18:39:09 - XlApp] Conversion to Dalvik format failed with error 2

Android プロジェクトに 5 つの外部 .jar ファイルを含めると、このエラーが発生します。どうすればいいのかわかりません。誰か助けてください!!!

--multi-dex オプションを使用してみてください。

しかし、このオプションを使用する方法はどこにも見つかりませんでした。

4

6 に答える 6

1

javadocドキュメントから:

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]
    [--multi-dex [--main-dex-list=<file> [--minimal-main-dex]]
    [<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.\n
    --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.

dxAndroid ビルド プロセスの一部として dexing で使用されるツールです。デフォルトの Android ビルドに使用される (にある) では、マクロ内で宣言された の一部として使用さbuild.xmlれます。--multi-dex をまだサポートしていない古いAnttaskがあります。sdk.dir/tools/ant/buildxmltarget name="-dex"dex-helper

ソース コードからdexer、 --main-dex-list オプションは、メイン dex に入れたいすべてのクラス ファイルを改行で区切ったファイル入力を受け取ります。このような:

bin/classes/com/example/MainActivity.class

このリストで宣言されていない他のすべてのクラスは、セカンダリ dex に移動します。

または、 --multi-dex が導入される前の古い方法を使用できます: http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

于 2014-02-02T21:57:12.380 に答える
0

只今編集中です

.../sdk/build-tools/19.0.3/dx

最後の行を置き換えます:

exec java $javaOpts -jar "$jarpath" --multi-dex "$@"

ハックです。それは維持可能ではありません。おそらくあなたの CI 管理者はあなたを嫌うでしょう...

しかし、それは働いています!

于 2014-05-14T08:14:31.427 に答える
0

As you know you have to modify build.xml a little bit which is located in tools if using ant build. you change output property from an archive to a directory (i.e $project/bin) and dx step will be done successfully. It may be so, but ant-tasks.jar and sdklib.jar are required to modify to complete 'apkbuilder' step.

  • ApkBuilder, ApkBuilderTask classes
于 2014-11-06T04:49:29.070 に答える
0

誰かがここでつまずいた場合は、追加しているライブラリを確認できます。通常、このエラー:
trouble writing output: Too many method references: 66024; max is 65536.多数のライブラリを追加すると発生します。私が何度も見た例の 1 つは、google-play-analytics のような特定の google-play サービスを追加したい場合、google-play ライブラリ全体を追加することです。特定のライブラリを追加してみてください。これで問題は解決します。

于 2016-01-26T10:27:49.293 に答える