Glide Version: 4.7.1
Device/Android Version: All, when compiling with the new Android-P SDK
Issue details / Repro steps / Use case background: Glide is incompatible with the new androidx. support library. Glide is dependant on some v4 support library stuff.
Glide load line / GlideModule (if any) / list Adapter code (if any):
Glide.with(context).load(list.get(position).getUrl()).into(holder.foobarImageView);
Layout XML:
<ImageView
android:id="@+id/foobar_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"/>
Stack trace / LogCat:
Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
at sun.reflect.GeneratedMethodAccessor296.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more
If excluding the com.android.support group in build.gradle:
error: cannot access Fragment
class file for android.support.v4.app.Fragment not found
This may be somewhat painful for us to migrate to if they've changed the package names on existing classes. If we change to use androidx we're going to end up forcing everyone to compile against P. If we don't change to androidx we're going to force people to continue to use the old package names until we do.
We are planing to migrate to androidx as soon as possible. We use very few libs and all are compatible with it other than glide.
What's the point of not migrating to androidx?
I think whoever prefers to remain on the old version of first class libs and not target Android P, will also not mind using older version of glide as well.
@sjudd
Is not just a matter of old package names, but the fact that from now on the support libraries are going to be updated only in the androidx package hierarchy, leaving the old package names as legacy.
Android Studio canary 14 has already a migration tool. In the short term it makes sense to migrate Glide to androidx, otherwise in no time developers are going to be stuck with a set of support libraries which are not going to be updated anymore.
https://developer.android.com/topic/libraries/support-library/androidx-rn
https://developer.android.com/topic/libraries/support-library/refactor
any solution or some results?
Can't the work for androidx just be done in a branch and then marked stable when DP3 comes out in a few weeks where the APIs are marked final?
Regardless this will need to happen, otherwise glide will depend on old aged libraries.
I see how lots of libraries are waiting for a stable androidx release, but before that, Glide could definitely be made Jetifier-friendly. This is the real task.
In my specific case, what is preventing me to use Glide is #3107 - the compiler checks for android.support.annotation.VisibleForTesting instead of androidx.annotation.VisibleForTesting.
This seems very easy to fix... Just check for both.
@sjudd would you accept a PR that does this? I'm not confident with the source, so maybe once this is fixed, more errors will come to the surface. But it is harmless. Once the reflection stuff is fixed, as far as I understand, the jetifier should be able to, well, jetify Glide on its own.
Are there any recommended workarounds how to make Glide work with AndroidX for now?
I have been using it with basic usage with no issue, but I had to remove the annotation processor due to #3107.
Could not reproduce the OP trace.
Is there any version of glide that works with this? at least for people to be able to compile their projects?
@mufumbo have you tried using the latest version without annotation processor?
@technoir42 i just been able to compile, but lost the overwrites, progress, and maybe okhttp stuff?
@mufumbo I think you can build without jetifier once, copy the generated files to src and remove the annotation processor for now. It'll be easy to revert back to AP once this issue is fixed because you'll be using the same API.
Also might be worth trying to move Glide AP and AppGlideModule from application module where jetifier is enabled to a separate library module.
Looks like a good idea but I don't think you can enable/disable jetifier on a per-module basis? @technoir42
Fixed in #3126 I believe.
@sjudd Any chance of a release for this fix please?
For those of you that need this who are waiting, you could use the snapshot 4.8.0-SNAPSHOT http://bumptech.github.io/glide/dev/snapshots.html
works
Hello, it's not working for me.
generatedClasses should use
import androidx.annotation.NonNull;
instead of
import android.support.annotation.NonNull;
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'androidx.annotation:annotation:1.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
(with
android.enableJetifier=true
android.useAndroidX=true
in gradle.properties)
worked for me
Kotlin Project
build.gradle
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
I was hacking around a bit, for those who don't want to Jetify the whole world (i.e. every other library in the project supports AndroidX):
implementation "androidx.fragment:fragment:1.0.0"
implementation("com.github.bumptech.glide:glide:4.9.0") {
exclude group: 'com.android.support'
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
annotationProcessor 'com.android.support:support-annotations:28.0.0'
android.useAndroidX=true
android.enableJetifier=true
android.jetifier.blacklist=^(?!.*[\\\\/]com\\.github\\.bumptech\\.glide[\\\\/]).*$
This magical regex turns the blacklist into a whitelist. See SO for more info on how the regex works.
The only drawback is:
WARNING: The option setting 'android.jetifier.blacklist=...' is experimental and unsupported.
Is this library still being maintained?I can't not believe that this issue has been for a while without being fixed.
At least you (Glide maintainers) should give us a clue whether they are working on it or not , Google play is forcing app releases to be targeting latest API 28 with which glide is not compatible .Please Help.
@Robotecom what exactly doesn't work for you? I'm using Glide 4.9.0 with AndroidX and API 28 without any issues.
Sorry ,I was using an old version of glide .Now ,I'm using 4.9.0 version
and everything seems to be working fine.
On Sun, 14 Jul 2019 at 17:44, Sergey Chelombitko notifications@github.com
wrote:
@Robotecom https://github.com/Robotecom what exactly doesn't work for
you? I'm using Glide 4.9.0 with AndroidX and API 28 without any issues.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bumptech/glide/issues/3080?email_source=notifications&email_token=ALM22YDECAAD75AQVIS436TP7M3TDA5CNFSM4E7IVLYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ4GYYY#issuecomment-511208547,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALM22YFHHRKQJZTDCAFVO6TP7M3TDANCNFSM4E7IVLYA
.
Glide is compiling class
GeneratedAppGlideModuleImpl
GlideOptions.java
GlideRequest
GlideRequests
GeneratedRequestManagerFactory.java
these are still using android support lib and there is error
import android.support.annotation.NonNull;
Glide version in project is 4.9.0
Nothing after one year? Really sad. Funny that this library was sponsored by Google now it's not maintained anymore. Using AndroidX is no more a choice since the old support library for android Q (api level 29) doesn't exist anymore, the latest package is for API 28. So if you want to target Q you need to use AndroidX library but now we can't use anymore Glide. Long life to Picasso.
@baldapps did you actually read this issue? Glide is compatible with AndroidX since 4.8.0.
And since you've mentioned it Glide seems to be much better maintained than Picasso. Picasso had only one release since March 2015 while Glide had 20.
Yeah and you? Did you read comments? It DOESN'T WORK and I'm using 4.9.0.
@baldapps please don't be so dismissive based on half information.
You can use Glide 4.9 with AndroidX (i.e. Glide is compatible with AndroidX via Jetifier) if you apply https://github.com/bumptech/glide/issues/3080#issuecomment-426331231 to your project. Look at the number of upvotes on that comment, it clearly worked for many people.
Re maintenance and Google backing. AndroidX migration was blocked because Glide is used internally at Google too. See https://github.com/bumptech/glide/pull/3518#issuecomment-489868017. Also if you look at the number of copybara commits on master you can see how much Google is contributing to the library.
With a bit of "research" I found that Glide 4.10 is going to support AndroidX (i.e. without Jetifier). See original PR #3518 superseded by PR #3678 which was merged to master 2.5 months ago to fix #3184 which is in 4.10 milestone; you can use it now with 4.10-SNAPSHOT.
I already applied what suggested, it doesn't work. Ignoring comments reported by the user wouldn't help you to fix things. You are still using classes of old deprecated packages. No idea how we could better describe the problem.
Since we seem to be running out of constructive comments, I'm locking this thread. Thanks everyone for your patience here. I'm optimistic that we're going to get this release out in the next couple of weeks. I'm trying to verify a couple of stability fixes.
I also appreciate everyone who took the time to post constructive comments here. I'm glad the community could help provide some tips for working around some of the issues that have cropped up.
Most helpful comment
(with
in gradle.properties)
worked for me