Glide Version: 4.0.0-RC0
Integration libraries: okhttp3-integration
In my gradle:
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
compile ('com.github.bumptech.glide:okhttp3-integration:1.5.0@aar'){
exclude group: 'glide-parent'
}
My new Glide configuration:
@GlideModule
public class GlideConfiguration extends AppGlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
// Apply options to the builder here.
RequestOptions requestOptions = new RequestOptions();
requestOptions.format(DecodeFormat.PREFER_ARGB_8888);
builder.setDefaultRequestOptions(requestOptions);
}
@Override
public void registerComponents(Context context, Registry registry) {
final OkHttpClient.Builder builder = RestCoreRetrofit.getInitialOkHttpClientBuilder();
registry.append(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build()));
}
}
For information getInitialOkHttpClientBuilder():
public static OkHttpClient.Builder getInitialOkHttpClientBuilder() {
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
// Setup timeouts
httpClient.connectTimeout(20, TimeUnit.SECONDS);
httpClient.readTimeout(60, TimeUnit.SECONDS);
httpClient.writeTimeout(60, TimeUnit.SECONDS);
return httpClient;
}
So, I've migrated v3 to v4 (http://bumptech.github.io/glide/doc/migrating.html). Migration and build are successful, but when I start my App, I have this crash now directly from the first GlideApp calling:
In my fragment:
GlideApp.with(this)
.load(resourceId)
.into(mBgImageView);
java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Registry)"
at com.bumptech.glide.Glide.initGlide(Glide.java:217)
at com.bumptech.glide.Glide.get(Glide.java:154)
at com.bumptech.glide.Glide.getRetriever(Glide.java:513)
at com.bumptech.glide.Glide.with(Glide.java:585)
at com.myapp.util.GlideApp.with(GlideApp.java:92)
I can't understand why. I checked several times the documentation.
Thank you very much for your support guys!
You're using 3.8.0's integration: 1.5.0@aar (also that exclude became irrelevant with 1.5.0)
@sjudd what would you think about adding a version mapping for all possible dependencies to the migration page?
I'd be totally happy to review a change: http://bumptech.github.io/glide/dev/contributing.html#documentation
Even I am getting the problem without any customization.
Also I am using Glide for the first time.
Here is what I am using
Gradle-
compile "com.android.support:support-v4:25.3.1"
//Glide
compile "com.github.bumptech.glide:glide:4.0.0-RC0"
annotationProcessor "com.github.bumptech.glide:compiler:4.0.0-RC0"
compile ("com.github.bumptech.glide:okhttp3-integration:1.5.0@aar") {
exclude group: 'glide-parent'
}
compile "com.squareup.okhttp3:okhttp:3.8.0"
In my Activity-
Glide.with(getApplicationContext())
.asBitmap()
.load(toolbar)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
Drawable drawable = new BitmapDrawable(getResources(), resource);
header.setBackground(drawable);
}
});
java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Registry)"
at com.bumptech.glide.Glide.initGlide(Glide.java:217)
at com.bumptech.glide.Glide.get(Glide.java:154)
at com.bumptech.glide.Glide.getRetriever(Glide.java:513)
at com.bumptech.glide.Glide.with(Glide.java:539)
at com.myapp.www.utils.common.ToolbarActivity.init(ToolbarActivity.java:38)
at com.myapp.www.utils.common.FooterActivity.init(FooterActivity.java:24)
at com.myapp.www.modules.home.HomeActivity.onCreate(HomeActivity.java:41)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
@jimitpatel do you have a GlideModule listed somewhere in your AndroidManifest.xml?
@sjudd
No I haven't listed anything about Glide in Manifest. But I just added an empty class after reading from this link: http://sjudd.github.io/glide/doc/generatedapi.html
The class is as follows -
@GlideModule
public class CustomAppGlideModule extends AppGlideModule {
}
After this I have changed the word Glide to GlideApp but result is same
OkHttp3 integration shouldn't be 1.5.0, that's for 3.8.0.
That gets merged into your manifest (see build directory for merged manifest).
Change to 2.0.0-RC0 iirc
@TWiStErRob I am not sure what you trying to say. Is that you want me to change version of com.github.bumptech.glide:okhttp3-integration: or you want me to change version of com.squareup.okhttp3:okhttp:
I am new to Glide, in fact today is the first day I started using it. So can you please provide more detail of what shall I do?
To make it clear, following will currently work:
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.github.bumptech.glide:okhttp3-integration:4.0.0-RC0@aar'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
@jimitpatel sorry, hasty texting while walking, thanks @MFlisar
getting same error on glide version 4.1.1
java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)"
at com.bumptech.glide.Glide.initializeGlide(Glide.java:231)
@mhdtouban can you please show your version of the libs that @MFlisar listed? from your grade file or gradlew dependencies.
@TWiStErRob here you go
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1'
implementation 'com.github.bumptech.glide:glide:4.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
Hey guys, why don't you update the documentation? There's still an old code snippet there.
@Pei116 Mind pointing out what part of the document you're referring to?
@sjudd I have to spend minutes to find out this latest code to integrate with OkHttp.
implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1@aar'
implementation 'com.github.bumptech.glide:glide:4.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
There's stupid code snippets titled 'OkHttp' and 'OkHttp 3' in your documentation.
@Pei116 which page are you talking about?
@TWiStErRob gettting some error in glide v4.1.1
java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)"
at com.bumptech.glide.Glide.initializeGlide(Glide.java:231)
Gradle :
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.github.bumptech.glide:glide:4.1.1'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1@aar'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
Check your transitive dependencies.
I was getting the same error with 4.1.1 because of another library I was including, that depended on glide 3.7.0.
I had to go back to using 3.7.0 (couldn't resolve it by excluding the 3.7.0 in the other library, since the modules api has changed a lot)
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.
FYI the documentation to which everyone's referring as being out-of-date is located here:
https://github.com/bumptech/glide/wiki/Integration-Libraries#okhttp-3-with-gradle
But the 4.1.1 version of the integration library seems to work for me. Thanks!
add "@GlideModule"
@GlideModule
public class MyGlideMoudle extends AppGlideModule {
...
}
Most helpful comment
To make it clear, following will currently work: