Android Common Resource as library for Android Application with Modular structure

449 views Asked by At

I have Android res folder with some xml and images.

What need to be done

Need to put all common resources in separate module and other module will be referring this module for UI creation .

What i have tried

I have created Android Library Module and kept only res folder and in my Android Instant App project structure. I have given the reference of Android Library in base module build.gradle. As other module have already reference of app module in their respective build.gradle then ideally it should work but its not working

Error : Android Linkage failed

1

There are 1 answers

0
Qazi Fahim Farhan On

In your settings.gradle add this:

include ':yourLibraryName'
project(':yourLibraryName').projectDir = new File(settingsDir, '/path/to/yourLibraryName')

Then go to your projects' build.gradle file and add this in the dependency:

dependencies{
    implementation project(':yourLibraryName')
}

Then you should be able to access library's files.