Issue
I have the following modules in my aaplication
Module
-app
-library_1
-library_2
the module library_1
'has dependecy of library_2
build gradle library_1
dependencies {
api project(":library_2")
}
When I build the project I get the aar which I put in my app module
dependencies {
implementation files('libs/library_1-debug.aar')
}
Now when I run my app I get the exception java.lang.NoClassDefFoundError: Failed resolution of: Lcom/dinklo/library_2/LibraryB
The class LibraryB
is defined in library_2
and being called from library_1
I am looking for a solution where I can get a single aar file for all the modules I have.
Solution
I ended up using third party library Fat-aar
In root build gradle
classpath 'com.github.kezong:fat-aar:1.3.8'
In your library module
apply plugin: 'com.kezong.fat-aar'
dependencies{
embed project(path: ':lib-2', configuration: 'default')}
I have added a sample project on github will be useful for others
Answered By - WISHY
Answer Checked By - Pedro (JavaFixing Volunteer)