20

I'm trying to develop simple instant app. I've done all modules and configurations, but when I'm trying to run instant up, gradle console show's me below error:

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

Does anyone know how to solve this problem?

cviejo
  • 4,388
  • 19
  • 30
Skye
  • 1,469
  • 3
  • 14
  • 25
  • 1
    Can you file a bug, then link to it back in here? They may need you to provide a reproducible project. It would be helpful for all, thanks! https://issuetracker.google.com/issues/new?component=316045&template=1018787 – TWL Aug 24 '17 at 17:29
  • You might want to test other of version of the plugin to your gradle plug-in, there may be some incompatibility issue between the plug-ins. You might want to check this [github issue](https://github.com/facebook/screenshot-tests-for-android/issues/44) that resolved the same issue by checking other version of the plugin. Hope this helps. – Mr.Rebot Aug 24 '17 at 17:54
  • Also seeing this issue, don't have a resolution yet. However before the O migration our IA was building ok. If I figure it out I'll come back here. – HaMMeReD Aug 25 '17 at 18:08
  • 1
    Did you manage to solve this? – Fran Marzoa Nov 05 '18 at 14:31
  • This solved my problem: File-> Invalidate Caches/Restart – Bhriguraj Salponia Jan 04 '21 at 09:26

5 Answers5

12

Make sure you have "baseFeature true" in the base feature defaultConfig.

If you have no base and only one feature, put baseFeature true in your one feature.

In older versions the feature without a name was the base, but now you need to explitly mark one.

HaMMeReD
  • 2,440
  • 22
  • 29
  • Already added baseFeature true but facing same issue. https://stackoverflow.com/questions/50362528/illegalstateexception-expected-configuration-moduledebugfeaturecompileclassp – Devganiya Hitesh May 16 '18 at 08:44
12

If you see the issue comes from a dynamic feature module, make sure this one depends on the "base" module or whatever module you applied:

apply plugin: 'com.android.application'

since it's going to be the one in charge of building the Android app.

When dynamic features came into play, the way the project is built changed. Until then the application module included all the library modules, but now dynamic feature modules need to include the application module as @ezio mentions:

https://stackoverflow.com/a/53916249/689723

cesards
  • 15,882
  • 11
  • 70
  • 65
  • 2
    This is such an important part of the documentation to have. It's a shame Google can't see fit to add this tidbit to their documentation. – Coder Roadie Dec 15 '19 at 00:50
2

In addition to what is mentioned in the accepted answer, I had to do one more thing to make it work. You have to make sure that all your feature modules should depend on the base module.

Put this in the gradle file of all the feature module

implementation project(':base')
Ezio
  • 2,837
  • 2
  • 29
  • 45
0

Make sure you have added feature dependency to InstantApp module.

This solution worked for me.

sagar
  • 1
  • 1
0

IDK why, but this solved my above problems when using dynamicFeatures

Error

Expected configuration ':features:auth:debugCompileClasspath' to contain exactly one file, however, it contains no files.

Problem

implementation project(path: ':base-app', configuration: 'default')

Fix

implementation project(":base-app")
mochadwi
  • 1,190
  • 9
  • 32
  • 87