Google Auto Factory: not annotated with @Provided?

隐身守侯 提交于 2019-12-04 11:17:30
adrian

It looks like the problem is mostly with annotation processing / dagger / missing javax jars.

I should thank cypressious on Github for posting his gradle build.gradle file, lifesaver.

https://github.com/evant/gradle-retrolambda/issues/31

  1. You need to use

    (i) With Dagger 2.0 the dependency problem still persists but you don't need any apt. so skip ahead to 3.

    apply plugin: 'com.neenbedankt.android-apt'

  2. Looks like using 'provided' for dependencies won't work with Google auto factory and need to use 'apt' plugin for dependencies instead. This includes dagger (if you're using it which I'm assuming) resulting in something like

    apt 'com.google.auto.factory:auto-factory:0.1-beta1'
    compile 'com.google.auto.factory:auto-factory:0.1-beta1'
    
    compile 'com.squareup.dagger:dagger:1.2.0'
    apt 'com.squareup.dagger:dagger-compiler:1.2.0'
    

    Now that's another big thing, at Dagger 1.2.1 / 1.2.2 is not supported, so I had to end up using Dagger 1.2.0.

  3. The last step you have to take this into your dependencies:

    compile 'javax.annotation:jsr250-api:1.0'

    It looks like the Generated annotation is not included as part of Java8? I'm not 100% of this or this is just how Gradle by default is not including the 'Generated' annotation as part of the annotation processing.

Anyways, after doing those three things Google Auto Factory appears available in my project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!