我正在创建一个示例来检查 Android 提供的动态特性交付。我的项目结构如下所示:基本项目 app 和一个动态特性 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’失败。 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77) ... Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.tools.build.bundletool.exceptions.ValidationException: Modules 'base' and 'sample_dynamic_feature' contain entry 'res/layout/activity_main.xml' with different content. at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63) at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40) ... Caused by: java.util.concurrent.ExecutionException: com.android.tools.build.bundletool.exceptions.ValidationException: Modules 'base' and 'sample_dynamic_feature' contain entry 'res/layout/activity_main.xml' with different content. at com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:56) ... Caused by: com.android.tools.build.bundletool.exceptions.ValidationException: Modules 'base' and 'sample_dynamic_feature' contain entry 'res/layout/activity_main.xml' with different content. at com.android.tools.build.bundletool.exceptions.ValidationException$Builder.build(ValidationException.java:49) ...这个包有什么区别?