Search code examples
androidandroid-layoutandroid-module

Created android module, trying to reference a layout but can't


I have created an android module and inside a Fragment defined in the module I am trying to inflate a R.layout.my_module_fragment:

Unfortunately it's not working:

val view = inflater.inflate(R.layout.my_module_fragment, container)

It throws Unresolved reference: my_module_fragment

build.gradle:

android {
    resourcePrefix 'mymodule'

    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }

    testOptions {
        unitTests.returnDefaultValues = true
        unitTests.includeAndroidResources = true
    }

    dataBinding.enabled = true

    testOptions {
        unitTests.returnDefaultValues = true
    }
}

I have created the layout under:

/Main_Project/MY_MODULE/main/res/layout

Solution

  • R import was linked to another R.