Closed steffkelsey closed 8 years ago
I haven't tried dagger 2, but dagger 1.2.1 works transparently.
If dagger 2 requires a separate build step, it would have to be implemented manually in sbt
Sent from my phone On Nov 6, 2015 5:48 AM, "Steff Kelsey" notifications@github.com wrote:
Hi, Love the plugin. I am trying to get it working with Android Studio and Dagger 2. I don't think the annotation processor is running. Does sbt work with the android-apt gradle plugin and if so how can I get it the dagger-compiler to run before everything else?
— Reply to this email directly or view it on GitHub https://github.com/pfn/protify/issues/9.
Do you have a sample project with dagger 1? I might just be setting things up wrong. I have dagger 2 setup with the android-apt plugin and the dagger-compiler dependency is not showing up in the gradle-generated.sbt. I tried adding it in a build.sbt file. I'll see if I can post a sample this weekend
I was able to build the android-simple example app using the following in build.sbt, you probably only need the last 3 libraryDependencies
lines:
androidBuild
platformTarget := "android-23"
libraryDependencies += "com.google.dagger" % "dagger" % "2.0.2"
libraryDependencies += "com.google.dagger" % "dagger-compiler" % "2.0.2" % "provided"
libraryDependencies += "javax.inject" % "javax.inject" % "1" % "provided"
libraryDependencies += "org.glassfish" % "javax.annotation" % "10.0-b28" % "provided"
I could not build the android-activity-graphs
sample as I got errors in dagger2 generated source.
[error] dagger\examples\android-activity-graphs\bin\intermediates\classes\com\example\dagger\activitygraphs\ui\DaggerHomeComponent.java:44: method create in class com.example.dagger.activitygraphs.ui.HomeActivity_MembersInjector cannot be applied to given types;
[error] required: javax.inject.Provider<android.location.LocationManager>
[error] found: dagger.MembersInjector,javax.inject.Provider<android.location.LocationManager>
[error] reason: actual and formal argument lists differ in length
[error] HomeActivity_MembersInjector.create
[error] dagger\examples\android-activity-graphs\bin\intermediates\classes\com\example\dagger\activitygraphs\ui\DaggerHomeComponent.java:46: method create in class com.example.dagger.activitygraphs.ui.HomeFragment_MembersInjector cannot be applied to given types;
[error] required: javax.inject.Provider<com.example.dagger.activitygraphs.ui.ActivityTitleController>
[error] found: dagger.MembersInjector,javax.inject.Provider<com.example.dagger.activitygraphs.ui.ActivityTitleController>
[error] reason: actual and formal argument lists differ in length
[error] HomeFragment_MembersInjector.create
@steffkelsey after talk with @pfn I think I know why it didn't work for you. Where is your build.sbt file? Are you using android-gradle-build
plugin? If yes, create build.sbt
in app/
folder (or whatever your application folder is), and specify dependency to dagger2 inside it, like:
libraryDependencies += "com.google.dagger" % "dagger-compiler" % "2.0.2" % "provided"
Hi, Love the plugin. I am trying to get it working with Android Studio and Dagger 2. I don't think the annotation processor is running. Does sbt work with the android-apt gradle plugin and if so how can I get it the dagger-compiler to run before everything else?