奇怪的gradle错误预期的配置(...)只包含一个文件,但是它不包含任何文件

Sky*_*kye 14 android android-instant-apps

我正在尝试开发简单的即时应用程序.我已经完成了所有模块和配置,但是当我试图立即运行时,gradle控制台显示我的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':blogspace-instant:packageDebugInstantAppBundle'.
> Expected configuration ':blogspace-instant:debugCompileClasspath' to contain exactly one file, however, it contains no files.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?

HaM*_*ReD 11

确保基本功能defaultConfig中有"baseFeature true".

如果您没有基础且只有一个功能,请将baseFeature设为true.

在旧版本中,没有名称的功能是基础,但现在您需要对其进行explitly标记.


ces*_*rds 7

如果您发现问题来自动态功能模块,请确保此功能取决于“基本”模块或您应用的任何模块:

apply plugin: 'com.android.application'
Run Code Online (Sandbox Code Playgroud)

因为它将成为构建Android应用程序的负责人之一。

当动态功能发挥作用时,项目的构建方式发生了变化。在此之前,该application模块包括所有库模块,但现在动态功能模块需要包括该application模块,如@ezio所提到的:

/sf/answers/3774137461/

  • 这是文档中非常重要的部分。遗憾的是,谷歌认为不适合将这个花絮添加到他们的文档中。 (2认同)