0

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
Tim Nuwin
  • 2,775
  • 2
  • 29
  • 63
  • module has own resources, you should create new layouts in module. You can't use 'app' module resources in library-modules, It will make circular dependencies... – Marek Kondracki May 10 '19 at 20:16

2 Answers2

0

As i am not able to comment so i post it there Have you added your module in app level build.gradle dependencies?

api project(path: ': your_module')
Vikas Sharma
  • 685
  • 8
  • 18
0

R import was linked to another R.

Tim Nuwin
  • 2,775
  • 2
  • 29
  • 63