Roboblender uses multi-module annotation databases

I am following the steps from the RoboBlender Wiki for using the annotation database, but I keep getting java.lang.IllegalStateException: Unable to use annotation database(s)

because I cannot findAnnotationDatabaseImpl

I am using Android Studio and Gradle. The project consists of several modules.

  • application
  • ModuleA
  • moduleB
  • moduleC

Here's what I added to my build scripts:

App / build.gradle:

dependencies {
  provided 'org.roboguice:roboblender:3.0.1'
  provided 'org.roboguice:roboblender:3.0.1'
}
project.tasks.withType(JavaCompile) { task ->
    options.compilerArgs << "-AguiceAnnotationDatabasePackageName=com.sample.myapp"
}

      

Module [x] /build.gradle:

project.tasks.withType(JavaCompile) { task ->
    options.compilerArgs << "-AguiceAnnotationDatabasePackageName=com.sample.module[x]"
}

      

In the application object:

 RoboGuice.setUseAnnotationDatabases(true);
 RoboGuice.getOrCreateBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE,
 RoboGuice.newDefaultRoboModule(this), new MyModule());
        RoboGuice.injectMembers(this, this);

      

Am I missing something? I found some similar questions, but they were not very helpful.

Update: I forgot to add it the first time, but yes, I am including the manifest meta.

<meta-data android:name="roboguice.modules" android:value="your.package.MyModule"/>  
<meta-data android:name="roboguice.annotations.packages" android:value="com.sample.myapp,com.sample.modulex,com.sample.moduley"/>

      

Update 2: I finally found the problem. Proguard was removing the class. Fixed by adding:

-keep public class * extends com.google.inject.AnnotationDatabase

      

+3


source to share


2 answers


After a few hours, I found the problem. This was the prologue. Adding the following line fixes the problem.

-keep public class * extends com.google.inject.AnnotationDatabase

      



You can check that the classes are generated on startup in the project folder:

find . | grep -i AnnotationDatabaseImpl

      

+2


source


Have you listed your module and annotation databases in AndroidManifest.xml

?



    <meta-data android:name="roboguice.modules" android:value="your.package.MyModule"/>  
    <meta-data android:name="roboguice.annotations.packages" android:value="com.sample.myapp,com.sample.modulex,com.sample.moduley"/>

      

+2


source







All Articles