gpt4 book ai didi

android - dexDebugTest失败,并带有DexException “Cannot merge new index”进行测试

转载 作者:行者123 更新时间:2023-12-03 04:46:08 25 4
gpt4 key购买 nike

我正在使用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

我的应用程序称为MyApp,它具有一个名为MyAppLibrary的依赖项项目。在切换到espresso之前,运行connectedAndroidTest时没有达到65k的限制。我以前使用过robotium,并且此后已经删除了那些依赖项。另外,当我只构建调试或发布构建时,我没有达到极限。有没有像优化调试版本那样优化我的测试版本的方法?

对我来说奇怪的是,我仅在MyApp中有测试,而MyAppLibrary中没有任何测试类。实际上,当我运行connectedAndroidTest时,实际上可以看到我的测试在设备上运行并通过MyAppLibrary:dexDebugTest。那么,为什么在运行我的测试后为什么它在那里失败呢?

或者,是否可以以某种方式绕过MyAppLibrary的connectedAndroidTest依赖关系链调用?

谢谢!

最佳答案

在build.gradle中,您需要指定:

android {
dexOptions {
jumboMode true
}
}

关于android - dexDebugTest失败,并带有DexException “Cannot merge new index”进行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25208221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com