问题描述
[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文件。我不知道该怎么做。请帮助我的人!
I am getting this error when I included 5 external .jar files in my android project. I have no idea what to do. Please help me out anyone!!!
我还以为做的是建议在此的 您可以尝试使用--multi-DEX选项
I thought of doing what is suggested in this You may try using --multi-dex option
不过,我找不到任何地方使用此选项的方法。
But I could not find method of using this option anywhere.
推荐答案
如果您正在使用摇篮/ Android的工作室,你可以添加到您的摇篮配置:
If you are using Gradle/Android Studio, you can add this to your gradle configuration:
android {
....
dexOptions {
preDexLibraries = false
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex'
// this is optional
// dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
}
}
然后你需要添加multidex支持库罐子,位于 SDK /演员/安卓/支持/ multidex /库/库
。并安装它通过从 MultiDexApplication
扩展您的应用程序,或调用 Multidex.install()
从应用程序的 attachBaseContext
方法。
Then you need to add the multidex support library jar, located in sdk/extras/android/support/multidex/library/libs
. And install it either by extending your application from MultiDexApplication
, or calling Multidex.install()
from your application's attachBaseContext
method.
有关更详细看这个博文:的
For more details look at this blogpost: http://blog.osom.info/2014/10/multi-dex-to-rescue-from-infamous-65536.html
更新:
下面 https://developer.android.com/tools/building/multidex.html 你可以找到使用multidex有摇篮的正式方法。
Here https://developer.android.com/tools/building/multidex.html you can find the official way to use multidex with Gradle.
基本上你需要改变你的摇篮文件是这样的:
Basically you need to change your gradle file like this:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
和设置您的应用程序类android.support.multidex.MultiDexApplication或者如果你已经有一个应用程序类,你可以覆盖attachBaseContext()方法,并调用MultiDex.install(本),以使multidex。
And set your Application class to android.support.multidex.MultiDexApplication or if you already have an Application class you can override the attachBaseContext() method and call MultiDex.install(this) to enable multidex.
这篇关于我如何使用`--multi-dex`的选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!