yahoo / squidb

SquiDB is a SQLite database library for Android and iOS
https://github.com/yahoo/squidb/wiki
Apache License 2.0
1.31k stars 132 forks source link

About integrating with Dagger 2. #125

Closed plateaukao closed 8 years ago

plateaukao commented 8 years ago

Hi, I try to use squidb 2.0.2 with Dagger 2. After adding dependencies from Dagger 2, my project won't be compiled any more. The dependency I added are:

// dagger2
compile 'com.google.dagger:dagger:2.0'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'javax.annotation:javax.annotation-api:1.2'

And the compilation error is:

Error:(58, 29) error: cannot find symbol class TimeRecord Warning:Supported source version 'RELEASE_6' from annotation processor 'com.yahoo.squidb.processor.ModelSpecProcessor' less than -source '1.7' Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

java.lang.NoSuchFieldError: MAP Information:BUILD FAILED

After searching the internet, I can't find anything similar to this issue. Could you tell me how I can fix this problem? Thanks.

sbosley commented 8 years ago

My guess is you're running into the same kind of problem as issue #82. When there's a compile-time error that prevents annotation processing from running to completion, the generated SquiDB models aren't visible, even though the error is elsewhere. Since the error started after you added the dagger dependency, I'm going to guess it's likely that there's a compile-time error in your dagger configuration (although you could have also inadvertently introduced a syntax error in a model spec annotation).

The best way to diagnose the problem is to move your SquiDB model specs into a separate module that your main app can then depend on. This will help you isolate the error to either an issue with your model specs or an issue with your dagger configuration, since they should then be compiled separately.

Hope that helps!

sbosley commented 8 years ago

Hi @plateaukao, were you able to resolve your issue?

sbosley commented 8 years ago

Closing this issue due to inactivity, still assuming it's a duplicate of issue 82.