2

I have an Android project which uses Autovalue to generate some of its models. I am attempting to move from the old com.android.support.* to the new androidx.* dependencies.

I know that in the Android Gradle Plugin 3.2+ it attempts to replace all occurrences of the old support dependencies, but this doesn't seem to extend to the interfaces that are generated by Autovalue. These interfaces still reference android.support.annotation.NonNull and android.support.annotation.Nullable, instead of androidx.annotation.*

'com.android.tools.build:gradle:3.2.1'

implementation "com.google.auto.value:auto-value-annotations:1.6.2"
annotationProcessor "com.google.auto.value:auto-value:1.6.2"

androidx version - 1.0.0

I have very little experience with these annotation processors, if there is any other information that might be relevant, please let me know.

Thanks for your suggestions.

Shooky
  • 1,269
  • 8
  • 16

1 Answers1

0

Check that your gradle.properties file includes these parameters as recommended in the migration guide that will allow the Android build system to migrate Maven dependencies for you that have not been migrated to the AndroidX namespace:

android.useAndroidX=true
android.enableJetifier=true

Additionally, the user guide for AutoValue recommends using 'api' instead of 'implementation/compile' for Android projects.

dragondrop
  • 31
  • 2
  • I have attempted the settings you listed above, but they did not correct the issue, it seems like they are applied before the Autovalue classes are generated, or it ignores those classes. Thank you for pointing out the `api` issue, I will try that and get back to you. – Shooky Feb 26 '19 at 17:19
  • Unfortunately, using api does not change anything. The generated dependencies are still using android.support.annotation – Shooky Feb 26 '19 at 18:18