matteolel
matteolel

Reputation: 519

Export Android Library that depends on an App Engine Module

I'd like to export an Android library module (module A) that depends on App Engine Module (module B).

In a new project with an app module (module C), I imported the module A importing the .aar file and the module B importing moduleB/build/libs/moduleB-android-endpoints.jar. Then I added module A and module B as dependencies of module C in the module C's gradle file.

I can compile without errors, but when I run module C app seems that the module B classes aren't in runtime classpath.

Some hint on how solve the problem?

This is the error:

Caused by: java.lang.NoClassDefFoundError: moduleB.backend.registration.Registration$Builder

Upvotes: 0

Views: 77

Answers (2)

matteolel
matteolel

Reputation: 519

I resolved adding these lines to the module C's gradle file:

compile ('com.google.api-client:google-api-client-android:1.17.0-rc') {
    exclude module: 'httpclient'
}
compile ('com.google.http-client:google-http-client-gson:1.17.0-rc') {
    exclude module: 'httpclient'
}

It was a problem related to inner Builder classes created automatically inside module B. They missed these dependences.

Upvotes: 0

Shashi Ranjan
Shashi Ranjan

Reputation: 651

Please go through following steps. It will solve your problem

1) Build module B and copy jar file. 2) Add module B jar (moduleB-android-endpoints.jar) into libs folder of module A. 3) Open module A app gradle file and add following code inside dependencies directory.

compile files('moduleB-android-endpoints.jar')

4) Synchronize module A and build. It will generate aar of module A. 5) Open module C and add aar file generated by module A into libs folder of module C. 6) Add following lines to module C app gradle file.

dependencies {    
   compile(name:'module A aar file name', ext:'aar')
}
repositories{
   flatDir{
      dirs 'libs'
    }
}

7) Sync and Rebuild module C. It will work

Upvotes: 1

Related Questions