我正在创建一个示例来检查 android 提供的动态功能交付。我有以下方式的项目结构。基础项目应用程序和一个动态功能sample_dynamic_feature。动态功能交付所需的所有设置均已到位。当我在基本模块和动态模块中添加任何具有相同名称的布局文件或 .xml 文件时,就会出现问题。我在基础应用程序和动态模块中都添加了activity_main.xml 。我收到以下错误:
什么地方出了错:
Execution failed for task ':app:packageReleaseBundle'.
> java.util.concurrent.ExecutionException: com.android.tools.build.bundletool.exceptions.ValidationException: com.android.tools.build.bundletool.exceptions.ValidationException: Modules 'base' and 'sample_dynamic_feature' contain entry 'res/layout/activity_main.xml' with different content.
适用于:
Above setup works fine in debug mode.
./gradlew assembleDebug
./gradlew assembleRelease
失败:
In case of release mode it gives me above error.
./gradlew bundleDebug
./gradlew bundleRelease
完整的堆栈跟踪:
例外是:org.gradle.api.tasks.TaskExecutionException:任务':app:packageReleaseBundle'的执行失败。在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77) 在 org.gradle. .api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) 在 org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在 org.gradle.api.internal .tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java: ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java :55) 原因:org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.tools.build.bundletool.exceptions.ValidationException: 模块'base'和'sample_dynamic_feature'包含条目'res/layout /activity_main.xml' 具有不同的内容。在 org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63) 在 org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java: ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99) ... 31 更多原因:java.util.concurrent.ExecutionException:com.android.tools.build.bundletool.exceptions.ValidationException:模块“base”和“sample_dynamic_feature”包含条目'res/layout/activity_main.xml' 具有不同的内容。在 com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:56) 在 kotlin.io.CloseableKt.closeFinally(Closeable.kt:53) 在 com.android.build.gradle.internal.tasks.PackageBundleTask .bundleModules(PackageBundleTask.kt:121) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) ... 44 更多原因:com.android.tools.build.bundletool。exceptions.ValidationException:模块“base”和“sample_dynamic_feature”包含具有不同内容的条目“res/layout/activity_main.xml”。在 com.android.tools.build.bundletool.exceptions.ValidationException$Builder.build(ValidationException.java:49) 在 com.android.tools.build.bundletool.exceptions.ValidationException$Builder.build(ValidationException.java:41)在 com.android.tools.build.bundletool.validation.EntryClashValidator.checkEqualEntries(EntryClashValidator.java:66) 在 com.android.tools.build.bundletool.validation.EntryClashValidator.validateAllModules(EntryClashValidator.java:52) 在 com.android .tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:
这个捆绑包有什么不同?