我正在将现有的多dex应用程序迁移到Instant应用程序中,并将我的应用程序转换为推荐的project structure。
有一堆相关的编译问题已经成功解决,但是在尝试运行可安装的“应用程序”模块时,我遇到了如下所示的堆栈跟踪错误。
我怀疑这是因为我现在的baseFeature
模块(之前的多dex应用程序)与即时应用程序架构不兼容。
任何有关处理此问题的最佳方法的线索?如果有人能够指出现有的multidex应用程序将如何移植到新的即时应用程序架构,那将会非常棒:)
堆栈追踪:
Error converting bytecode to dex:
Cause: InvokeDynamic not supported
com.android.dx.cf.iface.ParseException: InvokeDynamic not supported
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
at com.android.builder.dexing.DexArchiveBuilder.processOutputs(DexArchiveBuilder.java:110)
at com.android.builder.dexing.DexArchiveBuilder.convert(DexArchiveBuilder.java:91)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransformCallable.lambda$cacheMissAction$0(DexArchiveBuilderTransformCallable.java:236)
at com.android.builder.utils.FileCache.lambda$createFile$1(FileCache.java:260)
at com.android.builder.utils.FileCache.lambda$null$5(FileCache.java:443)
at com.android.builder.utils.SynchronizedFile.doActionWithSingleProcessLocking(SynchronizedFile.java:291)
at com.android.builder.utils.SynchronizedFile.write(SynchronizedFile.java:234)
at com.android.builder.utils.FileCache.lambda$queryCacheEntry$6(FileCache.java:415)
at com.android.builder.utils.SynchronizedFile.doActionWithSingleProcessLocking(SynchronizedFile.java:291)
at com.android.builder.utils.SynchronizedFile.read(SynchronizedFile.java:217)
at com.android.builder.utils.FileCache.queryCacheEntry(FileCache.java:391)
at com.android.builder.utils.FileCache.createFile(FileCache.java:273)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransformCallable.getFromCacheAndCreateIfMissing(DexArchiveBuilderTransformCallable.java:185)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransformCallable.call(DexArchiveBuilderTransformCallable.java:147)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransformCallable.call(DexArchiveBuilderTransformCallable.java:53)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.dx.cf.iface.ParseException: InvokeDynamic not supported
at com.android.dx.cf.cst.ConstantPoolParser.determineOffsets(ConstantPoolParser.java:226)
at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:132)
at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:491)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.builder.dexing.DexArchiveBuilderCallable.parseClass(DexArchiveBuilderCallable.java:86)
at com.android.builder.dexing.DexArchiveBuilderCallable.call(DexArchiveBuilderCallable.java:70)
at com.android.builder.dexing.DexArchiveBuilderCallable.call(DexArchiveBuilderCallable.java:43)
... 5 more
...while preparsing cst 0032 at offset 000000f1
...while parsing RangeDialogFragment.class
Execution failed for task ':installapp:transformClassesWithDexBuilderForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException:
com.android.builder.dexing.DexArchiveBuilder$DexBuilderException: Unable to convert input to dex archive.
答案 0 :(得分:1)
功能模块目前不支持multidex,因此每个功能模块应使用单个dex。
此问题没有通用解决方案,但我可以提出一些建议。