harisk92
harisk92

Reputation: 1118

Compiling one .aar library file from multiple modules

Hello everyone I have library project that consists from multiple modules :

I want to export all four modules as one .aar library file so I'm thinking about generating .aar files for each module and including it to other .aar file I'm not sure if this is going to work or is this good practice so I want your opinions on that ? And what is the best way to compile one .aar file from multiple modules ?

stack=java.lang.NoClassDefFoundError: Failed resolution of: Ldagger/internal/Preconditions .... Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.internal.Preconditions" on path: DexPathList[[...

It's seems dependencies don't get included into .aar file.

Upvotes: 7

Views: 4166

Answers (1)

Budius
Budius

Reputation: 39836

the "standard" way of doing it is to just direct use the modules in the compilation process that will generate the 1 aar.

So let's say module1 is the main part of the library, you'll have the following on it's build.gradle

apply plugin: 'com.android.library' // it's a library, generates aar

dependencies {
    // the other modules are dependencies on this one
    compile project(':module2')
    compile project(':module3')
    compile project(':module4')
}

Upvotes: 3

Related Questions