作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用gradle构建一个利用Google Espresso的android项目(这要归功于Jake Wharton的双重意式浓缩咖啡)。通过我的build.gradle配置,我可以使用proguard成功地构建调试和发行版本,以优化我的方法数量(以达到65k的限制以下),但是当我运行connectedAndroidTest时,我的构建失败了:
...
:src:MyApp:proguardDebug UP-TO-DATE
:src:MyApp:proguardDebugTest UP-TO-DATE
:src:MyApp:dexDebugTest UP-TO-DATE
:src:MyAppLibrary:prepareDebugTestDependencies
:src:MyAppLibrary:compileDebugTestAidl UP-TO-DATE
:src:MyAppLibrary:copyDebugLint UP-TO-DATE
:src:MyAppLibrary:mergeDebugProguardFiles UP-TO-DATE
:src:MyAppLibrary:checkDebugManifest
:src:MyAppLibrary:prepareDebugDependencies
:src:MyAppLibrary:compileDebugAidl UP-TO-DATE
:src:MyAppLibrary:compileDebugRenderscript UP-TO-DATE
:src:MyAppLibrary:generateDebugBuildConfig UP-TO-DATE
:src:MyAppLibrary:generateDebugAssets UP-TO-DATE
:src:MyAppLibrary:mergeDebugAssets UP-TO-DATE
:src:MyAppLibrary:generateDebugResValues UP-TO-DATE
:src:MyAppLibrary:generateDebugResources UP-TO-DATE
:src:MyAppLibrary:mergeDebugResources UP-TO-DATE
:src:MyAppLibrary:processDebugManifest UP-TO-DATE
:src:MyAppLibrary:processDebugResources UP-TO-DATE
:src:MyAppLibrary:generateDebugSources UP-TO-DATE
:src:MyAppLibrary:compileDebugJava UP-TO-DATE
:src:MyAppLibrary:processDebugJavaRes UP-TO-DATE
:src:MyAppLibrary:packageDebugJar UP-TO-DATE
:src:MyAppLibrary:compileDebugNdk UP-TO-DATE
:src:MyAppLibrary:packageDebugJniLibs UP-TO-DATE
:src:MyAppLibrary:packageDebugLocalJar UP-TO-DATE
:src:MyAppLibrary:packageDebugRenderscript UP-TO-DATE
:src:MyAppLibrary:packageDebugResources UP-TO-DATE
:src:MyAppLibrary:bundleDebug
:src:MyAppLibrary:assembleDebug
:src:MyAppLibrary:processDebugTestManifest UP-TO-DATE
:src:MyAppLibrary:compileDebugTestRenderscript UP-TO-DATE
:src:MyAppLibrary:generateDebugTestBuildConfig UP-TO-DATE
:src:MyAppLibrary:generateDebugTestAssets UP-TO-DATE
:src:MyAppLibrary:mergeDebugTestAssets UP-TO-DATE
:src:MyAppLibrary:generateDebugTestResValues UP-TO-DATE
:src:MyAppLibrary:generateDebugTestResources UP-TO-DATE
:src:MyAppLibrary:mergeDebugTestResources UP-TO-DATE
:src:MyAppLibrary:processDebugTestResources UP-TO-DATE
:src:MyAppLibrary:generateDebugTestSources UP-TO-DATE
:src:MyAppLibrary:compileDebugTestJava UP-TO-DATE
:src:MyAppLibrary:preDexDebugTest UP-TO-DATE
:src:MyAppLibrary:dexDebugTest
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Cannot merge new index 65623 into a non-jumbo instruction!
at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:108)
at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:25)
at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:71)
at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:48)
at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:840)
at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:811)
at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:784)
at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:680)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:540)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
:src:MyAppLibrary:dexDebugTest FAILED
最佳答案
在build.gradle中,您需要指定:
android {
dexOptions {
jumboMode true
}
}
关于android - dexDebugTest失败,并带有DexException “Cannot merge new index”进行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25208221/
我是一名优秀的程序员,十分优秀!