Skip to content

Glide compiler for AndroidX project partially supports androidx.annotation namespace #3185

Closed
@KevinLeigh

Description

@KevinLeigh

Currently Glide compiler is partially supporting androidx.annotation namespace, currently the AndroidX project I am building is failing because Glide compiler is still using android.support.annotation.CheckResult and android.support.annotation.NonNull rather than its successors androidx.annotation.NonNull & androidx.annotation.CheckResult.

I have tried with both versions 4.7.1 & 4.8.0-SNAPSHOT

It would be great if the AndroidX annotation namespace is completely supported rather than partially supported.

Basically any occurrence of android.support.annotation should change to androidx.annotation

Activity

changed the title [-]Glide compiler for AndroidX project partially supports `androidx.annotation`[/-] [+]Glide compiler for AndroidX project partially supports `androidx.annotation` namespace[/+] on Jul 5, 2018
KevinLeigh

KevinLeigh commented on Jul 5, 2018

@KevinLeigh
Author

For now I temporarily added the below so that there is no longer a compilation error:

// TODO remove temporary fix for Glide compiler issue
// Temporary fix begin
implementation 'com.android.support:support-annotations:27.1.1'
annotationProcessor 'com.android.support:support-annotations:27.1.1'
// Temporary fix end
Rajeshr34

Rajeshr34 commented on Jul 6, 2018

@Rajeshr34

Temporary fix not working for me with android databinding enabled.

KevinLeigh

KevinLeigh commented on Jul 6, 2018

@KevinLeigh
Author

@Rajeshr34 Hey there, are you using AndroidX? Please post your error as well

Rajeshr34

Rajeshr34 commented on Jul 6, 2018

@Rajeshr34

@KevinLeigh Same annotation errors.... also tried to make change and build but its not worked for me. is there any solution for this?

KevinLeigh

KevinLeigh commented on Jul 6, 2018

@KevinLeigh
Author

@Rajeshr34
It works fine on my side, please see below the project setup that I am using.

I am using Glide 4.8.0-SNAPSHOT for both annotation processor library and core library. I am using Android Studio IDE 3.3 Canary build Version 2 with Gradle version 4.8, as well as Gradle build tools 3.3.0-alpha02. I would not recommend this setup for a project that is in production that should use only stable versions of libraries. This current setup is only for trying out certain features that are not yet available in stable releases.

KevinLeigh

KevinLeigh commented on Jul 6, 2018

@KevinLeigh
Author

@Rajeshr34

Another thing is you should always clean rebuild your project correctly when making major updates.

The reason the temporary fix should work is because android.support.annotation does not exist when you update to use androidx.annotation, and Glide compiler is currently using both namespaces to generate classes. So importing older namespace android.support.annotation will include the missing namespace that no longer exists when using androidx.annotation, so your project should now have both namespaces.

Rajeshr34

Rajeshr34 commented on Jul 6, 2018

@Rajeshr34

@KevinLeigh Thank You. its working now

implementation 'com.github.bumptech.glide:glide:4.8.0-SNAPSHOT'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0-SNAPSHOT'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0-SNAPSHOT@aar'
implementation "com.android.support:support-annotations:28.0.0-alpha3"
annotationProcessor 'com.android.support:support-annotations:28.0.0-alpha3'
KevinLeigh

KevinLeigh commented on Jul 6, 2018

@KevinLeigh
Author

@Rajeshr34 All good, glad it is working on your side.

kerjani

kerjani commented on Jul 10, 2018

@kerjani

Hi,
The solution sounds good, but when will be the 4.8.0-SNAPSHOT version available?

Rajeshr34

Rajeshr34 commented on Jul 10, 2018

@Rajeshr34

@kerjani 4.8.0-SNAPSHOT is out

allprojects {
    repositories {
        google()
        jcenter()
        
        /*glide snapshot repo*/
        maven {
            name 'glide-snapshot'
            url 'http://oss.sonatype.org/content/repositories/snapshots'
        }

        //Image Gallery
        maven { url "https://jitpack.io" }
    }
}

mufumbo

mufumbo commented on Jul 12, 2018

@mufumbo

@Rajeshr34 is it working for you? here it's still using damn android.support.annotation package rather than android.xannotation

Shusshu

Shusshu commented on Jul 26, 2018

@Shusshu

4.8.0-SNAPSHOT works for me

mice777

mice777 commented on Aug 15, 2018

@mice777

I solved this by normally using stable version 4.7.1, and added files Nullable.java and CheckResult.java into my project from Android SDK sources (into correct path android\support\annotation). Then Glide finds its annotation classed, and it works, while my app uses AndroidX.

24 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mufumbo@IgorGanapolsky@sjudd@friederikewild@Shusshu

        Issue actions

          Glide compiler for AndroidX project partially supports `androidx.annotation` namespace · Issue #3185 · bumptech/glide