Dagger: migration to androidx library

Created on 12 May 2018  Â·  17Comments  Â·  Source: google/dagger

androidx.appcompat.app.AppCompatActivity
androidx.fragment.app.Fragment

instead of the old support library

Most helpful comment

Very unwise to do this prior to them being actually stable.

All 17 comments

Very unwise to do this prior to them being actually stable.

true

I guess I just couldn't hold my horses
great presentations btw, well done

On Sat, May 12, 2018 at 5:30 PM Jake Wharton notifications@github.com
wrote:

Very unwise to do this prior to them being actually stable.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/google/dagger/issues/1181#issuecomment-388531405, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAzQc-qpPkskv12wx_1OkorsIuLYTRE2ks5txnOIgaJpZM4T8SOx
.

>

Kind regards,
Derek

This is what jetifier is for, right?

This is what jetifier is for, right?

I think you're right, it worked for me after I added

android.useAndroidX=true
android.enableJetifier=true

to gradle.properties like mentioned here https://developer.android.com/topic/libraries/support-library/androidx-rn

I found an issue that after using jetifier, I couldn't upgrade dagger-android-processor greater than 2.16. It always shows that com.google.dagger:dagger-android-processor:2.18 -> 2.16

I found an issue that after using jetifier, I couldn't upgrade dagger-android-processor greater than 2.16. It always shows that com.google.dagger:dagger-android-processor:2.18 -> 2.16

same for me.

It would be great to support both Support Libs: androidx & android.support

android.useAndroidX=true
android.enableJetifier=true

It does not work for me so i continue to work with old support mechanism.

Error message: MainActivity is not a framework type abstract MainActivity mainActivity();

my dependencies:

def dagger_version = "2.20"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"

Doesn't work for me either.

Doesn't work for me either.

android.useAndroidX=true
android.enableJetifier=true

It does not work for me so i continue to work with old support mechanism.

Error message: MainActivity is not a framework type abstract MainActivity mainActivity();

my dependencies:

def dagger_version = "2.20"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"

I don't think they'll pay much attention to closed tickets. so unless someone reopens this, your best bet is to create a new ticket with detailed error message etc

updated my dagger version to "2.23.2" and my butterKnife to "10.1.0" and finally it worked.

It's now been close to a year since AndroidX hit stable. It should be time to migrate to AndroidX now as most other major tools have already left the support library and being forced to use the jettifier increases build time and complexity. Being stuck on the support library also prevents dagger from using the new things in Fragment for example (namely passing the layout file in the constructor when subclassing DaggerFragment).

People who are using the support library can use old versions of dagger without any issues.

additionally I was seeing issues with way the IDE resolves auto complete due to being a subclass of a jetified fragment. things like the back stack manager lookup not being present.

People who are using the support library can use old versions of dagger without any issues.

they are already choosing to use old versions of dependencies at that point, it seems inconsequential to move forward leaving them on their existing/working dependency tree.

@ronshapiro Should this issue be reopened?
Even if you do not have particular plans to migrate now, but at some point should be done, maybe when support-library will be deprecated and it would be necessary for all apps to migrate to AndroidX.
Currently, we have only 2 dependencies (among a few dozens) that still use old support library: Facebook SDK and Dagger Android

We discussed this recently and plan to do this soon. We plan to still keep around a legacy artifact for users still using the support fragments though.

Any news on this?
With 2.25.4 I still get:

+--- com.google.dagger:dagger-android-processor:2.25.4 -> 2.16
|    +--- com.google.dagger:dagger:2.16 -> 2.25.4 (*)
|    +--- com.google.dagger:dagger-android-jarimpl:2.16
|    +--- com.google.dagger:dagger-android-support-jarimpl:2.16
|    +--- com.google.googlejavaformat:google-java-format:1.4 -> 1.5 (*)
|    +--- com.google.guava:guava:23.3-jre -> 27.1-jre (*)
|    \--- com.squareup:javapoet:1.8.0 -> 1.11.1
Was this page helpful?
0 / 5 - 0 ratings