I'm trying to create an Instant App, but wanted to know if I can add an activity to my Instant App module.
When creating an Instant App module, the android studio wizard doesn't give you the option to add an activity either and was wondering if it is just supposed to be empty. I've tried adding an activity manually, but ran into some build issues.
Before I give up I just wanted to ask if an empty Instant App module is how it's designed to be and only supposed to rely on the base feature/feature modules as a dependency.
EDIT: When I try to add an activity to the com.android.instantapp
module, it cant find the R resource file. Also getting a build error :
Error:Execution failed for task :my-instantapp:packageDebugInstantAppBundle'. >
Expected configuration ':my-instantapp:debugCompileClasspath' to contain exactly
one file, however, it contains no files.
You can't add code to a module using the
com.android.instantapp
plugin.From the documentation:
Given that all code can be shared through
com.android.feature
modules with it's not necessary to have code in the instantapp module.For reusability it is recommended to have little to no code in modules that apply the
com.android.application
plugin, but to add dependencies to the projects like this:And host code within modules that rely on the
com.android.feature
plugin.These will be compiled like this: