'Create one aar from multi module library in android
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 1:[1]
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')}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | WISHY |