My app has two flavors core and foss, default flavor is core.
I've got 3 subfolders in my src folder, core, foss and main.
I'm trying to access my Home Screen which is referenced in the MainActivity and located in the main folder. The HomeScreen itself needs a HomeViewModel and that is contained in both the core and foss folder, but not in the main folder.

The odd thing for me is when I try to build the core flavor it accepts this as a valid import in the Home.kt file:
import viewmodels.HomeViewModel
In foss flavor it only accepts this import:
import com.blazecode.tsviewer.viewmodels.HomeViewModel
For my understanding these imports are essentially the same, but I have to change it every time I want to switch the flavor.
This is how I declared my flavors:
flavorDimensions "version"
productFlavors {
core {
dimension "version"
versionNameSuffix "-core"
}
foss {
dimension "version"
versionNameSuffix "-foss"
}
}
sourceSets {
core {
java.srcDirs = ['src/core/java']
}
foss {
java.srcDirs = ['src/foss/java']
}
}
Is there any way I can move files around or more ideally have one general import so that I don't have to manually change things?
Found the issue, the file's package declaration was different.
My core flavor file had this package declaration:
While the foss flavor one had this:
I changed both to
package viewmodelsand now it's working!