Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RoboGuice 3.0 NoClassDefFoundError: AnnotationDatabaseImpl

For some reason the RoboBlender does not generate the annotation database. My build.gradle has the following dependencies:

dependencies {
    provided 'org.roboguice:roboblender:3.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.roboguice:roboguice:3.0'
}
like image 807
jush Avatar asked Oct 30 '14 19:10

jush


2 Answers

This is not a final solution, but it can help you. I don't know why, but RoboGuice 3.0 and 3.0.1 throws this exception. What you have to do is disable annotations for databases in your MainActivity as follows:

static {
    RoboGuice.setUseAnnotationDatabases(false);
}

I hope this help

like image 74
Antonio Avatar answered Oct 03 '22 17:10

Antonio


Ok, so it seems that since I didn't have any injection in the main class MainActivity it didn't trigger the annotation processing of the inner AsyncTask. Therefore no annotation database was created.

Moreover, it seems that injection in anonymous inner classes is not supported. So the AsyncTask needs to be a proper class (it can still be inside the MainActivity).

I haven't figured out yet how to tell RoboGuice to inspect the inner classes even though the outer one does not have injections.

like image 22
jush Avatar answered Oct 03 '22 19:10

jush