An image loading and caching library for Android focused on smooth scrolling

Overview

Glide

Maven Central Build Status | View Glide's documentation | 简体中文文档 | Report an issue with Glide

Glide is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.

Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead.

Glide's primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image.

Download

For detailed instructions and requirements, see Glide's download and setup docs page.

You can download a jar from GitHub's releases page.

Or use Gradle:

repositories {
  google()
  mavenCentral()
}

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.12.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}

Or Maven:

<dependency>
  <groupId>com.github.bumptech.glide</groupId>
  <artifactId>glide</artifactId>
  <version>4.12.0</version>
</dependency>
<dependency>
  <groupId>com.github.bumptech.glide</groupId>
  <artifactId>compiler</artifactId>
  <version>4.12.0</version>
  <optional>true</optional>
</dependency>

For info on using the bleeding edge, see the Snapshots docs page.

ProGuard

Depending on your ProGuard (DexGuard) config and usage, you may need to include the following lines in your proguard.cfg (see the Download and Setup docs page for more details):

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
 <init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  *** rewind();
}

# for DexGuard only
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

How do I use Glide?

Check out the documentation for pages on a variety of topics, and see the javadocs.

For Glide v3, see the wiki.

Simple use cases will look something like this:

// For a simple view:
@Override public void onCreate(Bundle savedInstanceState) {
  ...
  ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

  Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);
}

// For a simple image list:
@Override public View getView(int position, View recycled, ViewGroup container) {
  final ImageView myImageView;
  if (recycled == null) {
    myImageView = (ImageView) inflater.inflate(R.layout.my_image_view, container, false);
  } else {
    myImageView = (ImageView) recycled;
  }

  String url = myUrls.get(position);

  Glide
    .with(myFragment)
    .load(url)
    .centerCrop()
    .placeholder(R.drawable.loading_spinner)
    .into(myImageView);

  return myImageView;
}

Status

Version 4 is now released and stable. Updates are released periodically with new features and bug fixes.

Comments/bugs/questions/pull requests are always welcome! Please read CONTRIBUTING.md on how to report issues.

Compatibility

  • Minimum Android SDK: Glide v4 requires a minimum API level of 14.
  • Compile Android SDK: Glide v4 requires you to compile against API 26 or later.

If you need to support older versions of Android, consider staying on Glide v3, which works on API 10, but is not actively maintained.

  • OkHttp 3.x: There is an optional dependency available called okhttp3-integration, see the docs page.
  • Volley: There is an optional dependency available called volley-integration, see the docs page.
  • Round Pictures: CircleImageView/CircularImageView/RoundedImageView are known to have issues with TransitionDrawable (.crossFade() with .thumbnail() or .placeholder()) and animated GIFs, use a BitmapTransformation (.circleCrop() will be available in v4) or .dontAnimate() to fix the issue.
  • Huge Images (maps, comic strips): Glide can load huge images by downsampling them, but does not support zooming and panning ImageViews as they require special resource optimizations (such as tiling) to work without OutOfMemoryErrors.

Build

Building Glide with gradle is fairly straight forward:

git clone https://github.com/bumptech/glide.git
cd glide
./gradlew jar

Note: Make sure your Android SDK has the Android Support Repository installed, and that your $ANDROID_HOME environment variable is pointing at the SDK or add a local.properties file in the root project with a sdk.dir=... line.

Samples

Follow the steps in the Build section to set up the project and then:

./gradlew :samples:flickr:run
./gradlew :samples:giphy:run
./gradlew :samples:svg:run
./gradlew :samples:contacturi:run

You may also find precompiled APKs on the releases page.

Development

Follow the steps in the Build section to setup the project and then edit the files however you wish. Android Studio cleanly imports both Glide's source and tests and is the recommended way to work with Glide.

To open the project in Android Studio:

  1. Go to File menu or the Welcome Screen
  2. Click on Open...
  3. Navigate to Glide's root directory.
  4. Select setting.gradle

For more details, see the Contributing docs page.

Getting Help

To report a specific problem or feature request, open a new issue on Github. For questions, suggestions, or anything else, email Glide's discussion group, or join our IRC channel: irc.freenode.net#glide-library.

Contributing

Before submitting pull requests, contributors must sign Google's individual contributor license agreement.

Thanks

Author

Sam Judd - @sjudd on GitHub, @samajudd on Twitter

License

BSD, part MIT and Apache 2.0. See the LICENSE file for details.

Disclaimer

This is not an official Google product.

Comments
  • Glide trying to load from assets directory instead of internet

    Glide trying to load from assets directory instead of internet

    Integration libraries: using Glide version: 4.6.1 using com.github.bumptech.glide:okhttp3-integration:4.6.1

    Device/Android Version: Samsung S6 Android version 24

    Issue details / Repro steps / Use case background: I am trying to load an image from Internet into ImageView but it seems like Glide is trying to load from assets directory instead of Internet.

      //this is the ApplicationContext
      RequestManager requestManager = Glide.with(this)
                    .applyDefaultRequestOptions(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE))
                    .applyDefaultRequestOptions(RequestOptions.placeholderOf(R.drawable.placeholder));
                requestManager
                        .applyDefaultRequestOptions(RequestOptions.skipMemoryCacheOf(true));
            }
            requestManager.load("http://opendata.toronto.ca/transportation/tmc/rescucameraimages/CameraImages/loc8015.jpg")
                    .into(image);
    
    

    Layout XML:

    <ImageView
                android:id="@+id/cam_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:layout_gravity="center"
                android:gravity="center"
                android:scaleType="fitCenter"
                />
    

    Stack trace / LogCat:

    Root cause (1 of 1)
      java.io.FileNotFoundException: No content provider:  http://opendata.toronto.ca/transportation/tmc/rescucameraimages/CameraImages/loc8015.jpg 
          at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1049)
          at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:904)
          at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:831)
          at com.bumptech.glide.load.data.AssetFileDescriptorLocalUriFetcher.loadResource(AssetFileDescriptorLocalUriFetcher.java:22)
          at com.bumptech.glide.load.data.AssetFileDescriptorLocalUriFetcher.loadResource(AssetFileDescriptorLocalUriFetcher.java:13)
          at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:44)
          at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:62)
          at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:299)
          at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:266)
          at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:230)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
          at java.lang.Thread.run(Thread.java:841)
          at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
    
    bug repro-needed 
    opened by weejim76 72
  • Share image in cache

    Share image in cache

    I have a question in regarding sharing an image via Intent Share API which was already downloaded in cache(or not in the worst case scenario). Do you have any suggestions regarding this? Would it work with the FileProvider class in the support lib? The current implementation now loads the URL in a custom target, writes the bitmap into a common file(share.jpeg) and shares that one with a custom ContentProvider. Works so far but it feels like extra unnecessary work which makes the user wait for a while for an image which is already there.

    question 
    opened by TepesLucian 56
  • NPE: 'int com.bumptech.glide.gifdecoder.GifHeader.frameCount'

    NPE: 'int com.bumptech.glide.gifdecoder.GifHeader.frameCount'

    glide:4.0.0-SNAPSHOT It's neither device nor Android version specific. I can't reproduce it, but it doesn't seem rare when looking at crash numbers. In this case it happened when returning from Activity A to Activity B and Activity B contains the animation. It possible that the ImageViews visibility state is changed shortly after returning to Activity B.

     public void setState(State state) {
            mState = state;
            if (state == State.WORKING) {
                setVisibility(VISIBLE);
                mIntroContainer.setVisibility(GONE);
                mEmptyContainer.setVisibility(GONE);
                mWorkingContainer.setVisibility(VISIBLE); //  android:id="@+id/working_overlay"
                Glide.with(getContext())
                        .load(COFFEE_ANIM_ASSET)
                        .apply(RequestOptions.formatOf(DecodeFormat.PREFER_RGB_565))
                        .apply(RequestOptions.placeholderOf(R.drawable.sdmanimation))
                        .into(mWorkingAnimation); // android:id="@+id/iv_working_animation"
            } else {
                Glide.with(getContext()).clear(mWorkingAnimation);
                mWorkingContainer.setVisibility(GONE);
                if (state == State.INTRO) {
                    setVisibility(VISIBLE);
                    mEmptyContainer.setVisibility(GONE);
                    mIntroContainer.setVisibility(VISIBLE);
                } else if (state == State.NORESULTS) {
                    setVisibility(VISIBLE);
                    mIntroContainer.setVisibility(GONE);
                    mEmptyContainer.setVisibility(VISIBLE);
                } else if (state == State.GONE) {
                    setVisibility(GONE);
                    mIntroContainer.setVisibility(GONE);
                    mEmptyContainer.setVisibility(GONE);
                }
            }
        }
    
        <LinearLayout
            android:id="@+id/working_overlay"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:orientation="vertical"
            android:padding="16dp"
            android:visibility="gone"
            tools:visibility="visible">
    
            <ImageView
                android:id="@+id/iv_working_animation"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:padding="5dp"
                android:src="@drawable/sdmanimation"/>
        </LinearLayout>
    
    Caused by: java.lang.NullPointerException: Attempt to read from field 'int com.bumptech.glide.gifdecoder.GifHeader.frameCount' on a null object reference
    at com.bumptech.glide.gifdecoder.GifDecoder.getFrameCount(GifDecoder.java:262)
    at com.bumptech.glide.load.resource.gif.GifFrameLoader.getFrameCount(GifFrameLoader.java:139)
    at com.bumptech.glide.load.resource.gif.GifDrawable.startRunning(GifDrawable.java:166)
    at com.bumptech.glide.load.resource.gif.GifDrawable.start(GifDrawable.java:154)
    at com.bumptech.glide.request.target.ImageViewTarget.onStart(ImageViewTarget.java:102)
    at com.bumptech.glide.manager.TargetTracker.onStart(TargetTracker.java:31)
    at com.bumptech.glide.RequestManager.onStart(RequestManager.java:245)
    at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:51)
    at com.bumptech.glide.manager.SupportRequestManagerFragment.onStart(SupportRequestManagerFragment.java:175)
    at android.support.v4.app.Fragment.performStart(Fragment.java:1986)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1102)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1230)
    at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2047)
    at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:176)
    at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:553)
    at eu.thedarken.sdm.SDMServiceActivity.onStart(SDMServiceActivity.java:79)
    at eu.thedarken.sdm.SDMMainActivity.onStart(SDMMainActivity.java:155)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
    at android.app.Activity.performStart(Activity.java:6006)
    at android.app.Activity.performRestart(Activity.java:6063)
    at android.app.Activity.performResume(Activity.java:6068)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5254) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
    
    bug v4 
    opened by d4rken 51
  • Questions about recycling

    Questions about recycling

    Me again :)

    Got some questions about when images are recycled and how internals works, since I get way more java.lang.RuntimeException: Canvas: trying to use a recycled bitmap than before switching to Glide.

    Since I can't reproduce it's hard to find the cause.

    Numbers are not very high (5000 crash on more than 7 000 000 screen views per week glide 3.6.0) but high enough for me to investigate.

    Most calls are basics :

    Glide.with(ctx)
         .load(xxx)
         .centerCrop()
         .animate(R.anim.abc_fade_in)
         .error(R.drawable.default_thumb_fanart_misc)
         .into(mViewFanart);
    
    

    Context is sometimes application context to simplify reused code, is there impact of not using fragment / activities ?

    The only other call that could trigger is:

    .into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) {
            if (isAdded() && mViewThumb != null) {
                mViewThumb.setImageBitmap(bitmap);
            }
        }
    
        @Override
        public void onLoadFailed(Exception e, Drawable errorDrawable) {
            if (isAdded() && mViewThumb != null) {
                mViewThumb.setImageDrawable(errorDrawable);
            }
        }
    
        @Override
        public void onLoadCleared(Drawable placeholder) {
            super.onLoadCleared(placeholder);
            try {
                mViewThumb.setImageResource(R.drawable.default_thumb_big);
            } catch (Exception ignore) {
            }
        }
    });
    

    But from my understanding of the docs the onLoadCleared that I use should cover this problem.

    Any advice / tips on how / what to check to find the root cause ?

    question stale 
    opened by Tolriq 51
  • Predefined item height before image arrives

    Predefined item height before image arrives

    How should i set up Glide and my xml for each item if i all ready know the heights of images. Until know i set my ImageView to wrap_content

    <ImageView
        android:id="@+id/item_image_img"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:contentDescription="@string/img_content"
        android:scaleType="fitXY"/>
    

    That works fine but as soon as image arrives it stretches the placeholder and the scrolling jumps giving an awful experience to user

    question 
    opened by AngleV 49
  • Crash when activity is destroyed

    Crash when activity is destroyed

    TLDR; Glide should just log and cancel the load instead of crashing when the activity is destoryed since there is no point in loading anything. The user of the library shouldn't have to explicitly handle this situation.


    Glide Version/Integration library (if any): 'com.github.bumptech.glide:glide:3.6.1' Device/Android Version: Any/Android 5.0+ Issue details/Repro steps/Use case background:

    This issue is related to issue #138. When making a call on glide if the activity has been destroyed it will throw an IllegalArgumentException. The following code in the RequestManagerRetriever.java class is responsible:

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    private static void assertNotDestroyed(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
            throw new IllegalArgumentException("You cannot start a load for a destroyed activity");
        }
    }
    

    This is causing a crash in my crashlytics console for a small percentage of my users. There is likely some kind of timing issue where the user hits home as they are scrolling a big list and the activity is cleaned up which results in this crash. I could fix this issue by wrapping glide and running this code myself and simply not calling glide in this situation. However I believe this is the wrong approach, the library shouldn't be crashing in this situation and instead should log and do nothing.

    If the activity is destroyed then the view that is being displayed which the image is being displayed is not visible and as a result no exception should be thrown. Instead glide should log and simply not show the image. Users of the library should not have to explicitly handle situations like these, it makes more sense to just handle it in the library.

    Glide load line:

    Glide.with(context).load(url).bitmapTransform(new GrayscaleTransformation(getContext())).into(imageView);
    

    Layout XML: not relevant

    Stack trace / LogCat:

    Fatal Exception: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
           at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:134)
           at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:102)
           at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:87)
           at com.bumptech.glide.Glide.with(Glide.java:620)
           at com.myapp.myapp$24.run(MyAppClass.java:977)
           at android.os.Handler.handleCallback(Handler.java:739)
           at android.os.Handler.dispatchMessage(Handler.java:95)
           at android.os.Looper.loop(Looper.java:135)
           at android.app.ActivityThread.main(ActivityThread.java:5431)
           at java.lang.reflect.Method.invoke(Method.java)
           at java.lang.reflect.Method.invoke(Method.java:372)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
    
    wontfix 
    opened by michaelrhughes 49
  • cannot resolve symbol 'GlideApp' (GlideApp was not generated)

    cannot resolve symbol 'GlideApp' (GlideApp was not generated)

    I'm using 4.0.0-RC0, I added it by Gradle:

    repositories {  mavenCentral() // jcenter() works as well because it pulls from Maven Central } dependencies {  compile 'com.android.support:appcompat-v7:25.3.1'  compile 'com.github.bumptech.glide:glide:4.0.0-RC0'  compile 'com.android.support:support-v4:25.3.1'  annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0' }

    I followed the here: https://github.com/bumptech/glide/tree/master/samples/svg/src/main/java/com/bumptech/glide/samples/svg But when i try load SVG file to ImageView, i get error message: cannot resolve symbol 'GlideApp' I think GlideApp class was not generated. My source:

    package com.example.quangson.glidesvg; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; import android.graphics.drawable.PictureDrawable; import android.net.Uri; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.RequestBuilder; import com.caverock.androidsvg.SVGImageView; import com.example.quangson.glidesvg.glide.SvgSoftwareLayerSetter; public class MainActivity extends AppCompatActivity {  private static final String TAG = "SVGActivity";  private ImageView imageViewRes;  private ImageView imageViewNet;  private RequestBuilder requestBuilder;  @Override  protected void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);   setContentView(R.layout.activity_main);   imageViewRes = (ImageView) findViewById(R.id.svg_image_view1);   imageViewNet = (ImageView) findViewById(R.id.svg_image_view2);   requestBuilder = GlideApp.with(this)     .as(PictureDrawable.class)     .placeholder(R.drawable.image_loading)     .error(R.drawable.image_error)     .transition(withCrossFade())     .listener(new SvgSoftwareLayerSetter());   Uri uri = Uri.parse("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg");   requestBuilder.load(uri).into(imageViewNet);  } }

    How to generate GlideApp class? Please help

    opened by sonzerolee 45
  • Removed synthetic methods

    Removed synthetic methods

    Description

    This removes all the synthetic methods. Issue #1555

    Motivation and Context

    This change helps us reduce the method count and therefore also helps us avoid the trampoline created because of synthetic methods.

    enhancement non-library v4 
    opened by RiteshChandnani 45
  • Some images simply do not download (Black image) - Android

    Some images simply do not download (Black image) - Android

    Hi, In some devices (Moto X) do not download correctly, like the screenshot attached. When i skipMemoryCache(true) it works, because Glide download the image again. I already use asBitmap() with imageDecoder() and the problem still occur.

    But, in my other device (Nexus 4) this problem doesn't occur. Glide works perfectly

    I tried to config listener() to log Exceptions but never called onException() method. In other words, no Exceptions occurs. Its weird.

    Best, Thiago Luis.

    screenshot_2015-11-12-16-45-43

    bug enhancement 
    opened by thiagoluis88 44
  • Wrong images being loaded in Recycler View's grid on Some devices

    Wrong images being loaded in Recycler View's grid on Some devices

    In my app, I have a Recycler view with GridLayoutManager. The code I am using to load images bindImage method of recycler view adapter:

    @Override
    public void onBindViewHolder(ImageViewHolder holder, int position) {
        GSImage dbImage = mLandscapeImagesList.get(position);
        File imageFile = new File(mImageDirectoryFile, dbImage.getImageName());
    
        Glide.with(MyImageFragement.this).load(imageFile).centerCrop().into(holder.imageView);
    
        int indexInSelectedImagesSet = mSelectedLandscapeImages.indexOf(dbImage);
        if (indexInSelectedImagesSet>-1){
            holder.itemView.setSelected(true);
        } else {
            holder.itemView.setSelected(false);
        }
    
    }
    

    The Cell layout I am using is:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@drawable/images_background"
          android:layout_marginTop="9dp"
          android:layout_marginLeft="10dp"
          android:layout_marginRight="0dp"
          android:layout_marginBottom="0dp"
          android:padding="2dp">
    
          <com.gaurav.myProject.commons.AspectRatioImageView
                     android:id="@+id/image_thumb"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:scaleType="fitXY"
                     app:viewAspectRatio="1.33"/>
    
    </RelativeLayout>
    

    Here AspectRatioImageView(subclass of ImageView) automatically resizes the height of image view according to the provided aspect ratio.

    The above code is working fine on my devices (Xiaomi MiPad, ViewSonic Tablet, Android emaulators and Samsung Galaxy S3) but is not working correctly on my client's device (Samsung 10.1 inch tablet). In his end, images are being duplicated in the recycler grid. Also the the duplicates mostly occurs in adjacent recycler grid positions. I can't share any code as I even unable to reproduce the issue on my devices.

    Do you guys have any idea what could the cause of this? Can you please suggest me any thing that I can try?

    Thanks

    question stale 
    opened by gauravlnx 43
  •  Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 14281 (glide-disk-cach)

    Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 14281 (glide-disk-cach)

    I call the glide method in the viewpage + fragment.Then when I change the viewpage states or click the fragment into the detail activity,the app would crash.The faster I changed,the faster the APP crashes. Why do you report this crash? Is it related to disk cache?

    Recently, we found many times throw this exception

    --------- beginning of crash 11-20 15:28:46.368 22100 14281 F google-breakpad: Microdump skipped (uninteresting) 11-20 15:28:46.417 13699 14281 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 14281 (glide-disk-cach) 11-20 15:28:46.596 22106 22106 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 11-20 15:28:46.597 22106 22106 F DEBUG : Build fingerprint: 'HUAWEI/MHA-AL00/HWMHA:7.0/HUAWEIMHA-AL00/C00B231:user/release-keys' 11-20 15:28:46.597 22106 22106 F DEBUG : Revision: '0' 11-20 15:28:46.597 22106 22106 F DEBUG : ABI: 'arm' 11-20 15:28:46.597 22106 22106 F DEBUG : pid: 13699, tid: 14281, name: glide-disk-cach >>> com.smartvideo.phone <<< 11-20 15:28:46.597 22106 22106 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4 11-20 15:28:46.597 22106 22106 F DEBUG : r0 00000004 r1 cc3f9060 r2 c86d55e0 r3 cc3f8fa4 11-20 15:28:46.597 22106 22106 F DEBUG : r4 cc3f9044 r5 cc3f9050 r6 c86d55e0 r7 cc3f96bc 11-20 15:28:46.597 22106 22106 F DEBUG : r8 00000000 r9 00000000 sl cc3f95b4 fp cc3f8fa0 11-20 15:28:46.597 22106 22106 F DEBUG : ip ee19f15c sp cc3f8d78 lr edf1202d pc edf0f9b2 cpsr 000a0030 11-20 15:28:46.607 22106 22106 F DEBUG : 11-20 15:28:46.607 22106 22106 F DEBUG : backtrace: 11-20 15:28:46.607 22106 22106 F DEBUG : #00 pc 001309b2 /vendor/lib/libskia.so (_ZN15SkShaderBlitterC1ERK8SkPixmapRK7SkPaintPN8SkShader7ContextE+61) 11-20 15:28:46.608 22106 22106 F DEBUG : #1 pc 00133029 /vendor/lib/libskia.so (_ZN23SkARGB32_Shader_BlitterC2ERK8SkPixmapRK7SkPaintPN8SkShader7ContextE+24) 11-20 15:28:46.608 22106 22106 F DEBUG : #2 pc 001308f7 /vendor/lib/libskia.so 11-20 15:28:46.608 22106 22106 F DEBUG : #3 pc 00130729 /vendor/lib/libskia.so (_ZN9SkBlitter6ChooseERK8SkPixmapRK8SkMatrixRK7SkPaintP16SkSmallAllocatorILj3ELj1500EEb+936) 11-20 15:28:46.608 22106 22106 F DEBUG : #4 pc 001462cb /vendor/lib/libskia.so 11-20 15:28:46.608 22106 22106 F DEBUG : #5 pc 0014720f /vendor/lib/libskia.so (ZNK6SkDraw8drawRectERK6SkRectRK7SkPaintPK8SkMatrixPS1+606) 11-20 15:28:46.608 22106 22106 F DEBUG : #6 pc 00128461 /vendor/lib/libskia.so (_ZN14SkBitmapDevice8drawRectERK6SkDrawRK6SkRectRK7SkPaint+22) 11-20 15:28:46.608 22106 22106 F DEBUG : #7 pc 00139ff5 /vendor/lib/libskia.so (_ZN8SkCanvas10onDrawRectERK6SkRectRK7SkPaint+336) 11-20 15:28:46.608 22106 22106 F DEBUG : #8 pc 0013cc0b /vendor/lib/libskia.so (_ZN8SkCanvas14drawRectCoordsEffffRK7SkPaint+162) 11-20 15:28:46.608 22106 22106 F DEBUG : #9 pc 7449d123 /data/dalvik-cache/arm/system@[email protected] (offset 0x17b3000)

    stale needs triage 
    opened by JwyinKevin 41
  • CustomTarget width & height parameter is PX or DP?

    CustomTarget width & height parameter is PX or DP?

        Glide.with(context)
            .asDrawable()
            .load(imageUrl)
            .into(object: CustomTarget<Drawable>(32, 32) { // <--- This is in dp or px?
                override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
                     // no-op
                }
                override fun onLoadCleared(placeholder: Drawable?) {
                    // no-op
                }
            })
    

    As titled, the constructor for CustomTarget accepts width and height as the requested size. But it did not mention if they should be px or dp.

    opened by flamyoad 0
  • about Executors  shutdownAndAwaitTermination

    about Executors shutdownAndAwaitTermination

    https://github.com/bumptech/glide/blob/master/library/src/main/java/com/bumptech/glide/util/Executors.java#L43

    I think first shutdownNow() may be use shutdown() instead

      @VisibleForTesting
      public static void shutdownAndAwaitTermination(ExecutorService pool) {
        long shutdownSeconds = 5;
        // may be use  pool.shutdown()  
        pool.shutdownNow();
        try {
          if (!pool.awaitTermination(shutdownSeconds, TimeUnit.SECONDS)) {
            pool.shutdownNow();
            if (!pool.awaitTermination(shutdownSeconds, TimeUnit.SECONDS)) {
              throw new RuntimeException("Failed to shutdown");
            }
          }
        } catch (InterruptedException ie) {
          pool.shutdownNow();
          Thread.currentThread().interrupt();
          throw new RuntimeException(ie);
        }
      }
    
    bug 
    opened by 6a209 0
  • GlideUrl.equals with respect to headers elements

    GlideUrl.equals with respect to headers elements

    GlideUrl equality by headers elements, not headers objects themself.

    Why it is needed. As a kotlin user you can easily create GlideUrl like this

    GlideUrl(someUrl) {
        someMapOfHeaders
    }
    

    It will be an anonymous implementation of Headers interface, and now two GlideUrl with same url and headers won't be equal. Which is wrong in my opinion. It causes image flickering when data updates and GlideUrls constructed like this.

    opened by asimaruk 0
  • java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@ea5bf3d

    java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@ea5bf3d

    Hi Glide team,

    Recently after app release we started seeing this issue for few users.

    java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@ea5bf3d

    The glide that we are using is com.github.bumptech.glide:glide:4.11.0

    the retrofit library that we are using is com.squareup.retrofit2:retrofit:2.9.0

    Following is the code snippet I am using for loading a image using glide into imageView

    context?.let { context ->
                Glide.with(context)
                    .load(story.url)
                    .diskCacheStrategy(DiskCacheStrategy.NONE)
                    .skipMemoryCache(true)
                    .placeholder(binding.ivStory.drawable)
                    .listener(object: RequestListener<Drawable> {
                        override fun onLoadFailed(
                            e: GlideException?,
                            model: Any?,
                            target: Target<Drawable>?,
                            isFirstResource: Boolean
                        ): Boolean {
                            return false
                        }
    
                        override fun onResourceReady(
                            resource: Drawable?,
                            model: Any?,
                            target: Target<Drawable>?,
                            dataSource: DataSource?,
                            isFirstResource: Boolean
                        ): Boolean {
                            binding.loader.visibility = View.GONE
                            animation.start()
                            return false
                        }
                    }
                    )
                    .into(binding.ivStory)
    

    The error that I am getting on firebase is as follows

    Fatal Exception: java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@d7a7131
           at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:55)
           at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:234)
           at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)
           at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)
           at android.widget.ImageView.onDraw(ImageView.java:1376)
           at android.view.View.draw(View.java:19442)
           at android.view.View.updateDisplayListIfDirty(View.java:18392)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
           at android.view.View.draw(View.java:19445)
           at android.view.View.updateDisplayListIfDirty(View.java:18392)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
           at android.view.View.draw(View.java:19445)
           at android.view.View.updateDisplayListIfDirty(View.java:18392)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.draw(View.java:19445)
           at android.view.View.updateDisplayListIfDirty(View.java:18392)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.updateDisplayListIfDirty(View.java:18383)
           at android.view.View.draw(View.java:19170)
           at android.view.ViewGroup.drawChild(ViewGroup.java:4324)
           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4087)
           at android.view.View.draw(View.java:19445)
           at com.android.internal.policy.DecorView.draw(DecorView.java:892)
           at android.view.View.updateDisplayListIfDirty(View.java:18392)
           at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:676)
           at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:682)
           at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:790)
           at android.view.ViewRootImpl.draw(ViewRootImpl.java:3503)
           at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3285)
           at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2782)
           at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1718)
           at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7513)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1066)
           at android.view.Choreographer.doCallbacks(Choreographer.java:878)
           at android.view.Choreographer.doFrame(Choreographer.java:794)
           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1052)
           at android.os.Handler.handleCallback(Handler.java:790)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loop(Looper.java:210)
           at android.app.ActivityThread.main(ActivityThread.java:7080)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:523)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:863)
    

    Can you please help me understand what I am doing wrong here; Or if i can replace/improve this code to avoid this issue

    opened by animeshPE91 0
  • Support loading placeholders in compose previews

    Support loading placeholders in compose previews

    Composable placeholders already worked, but resource and drawable placeholders did not. Presumably some part of the production codepath isn't supported by the Android Studio renderer. The actual display of the resources seems to work fine, we just never get to that point in Glide's code. Debugging exactly what's happening seems mostly impossible. I don't see a way to view logs or debug code running in the Android Studio preview renderer.

    For now we can work around whatever the issue is by rendering resources and drawables when in preview mode earlier than normal.

    import-ready 
    opened by sjudd 0
Releases(v4.14.2)
A powerful image downloading and caching library for Android

Picasso A powerful image downloading and caching library for Android For more information please see the website Download Download the latest AAR from

Square 18.4k Dec 31, 2022
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023
Image Cropping Library for Android

uCrop - Image Cropping Library for Android This project aims to provide an ultimate and flexible image cropping experience. Made in Yalantis How We Cr

Yalantis 11.4k Jan 2, 2023
lazy-language-loader improves loading times when changing your language by only reloading the language instead of all the game resources!

lazy-language-loader lazy-language-loader improves loading times when changing your language by only reloading the language instead of all the game re

Shalom Ademuwagun 7 Sep 7, 2022
Simple springboot API for addressBook. Supports all REST controllers and have custom error handling for every specific case, also supports redis caching.

AddressBook-SpringBoot-API Simple Springboot API for addressBook with redis cache. Supports all REST controllers and have custom error handling for ev

Shirish Saxena 1 Jan 21, 2022
Spring-boot application using redis as a caching database

Java Spring-boot application using Redis as a caching database Running Application Entities involved Two main entities are involved MasterHouse (maste

null 18 Aug 9, 2022
Small app to create icon sets for Linux, Windows, OSX, Android and IOS from a single PNG image

FXIconcreator Small app to create icon sets (multi resolution) for Linux, Windows, OSX from a single PNG image Reason for creating such an app was tha

null 18 Aug 4, 2022
Example usage of work manager in Android, while doing this study, image downloading was preferred as a method.

android-workmanager-example Example usage of work manager in Android, while doing this study, image downloading was preferred as a method. Java 11 com

Adil Çetin 1 Jan 29, 2022
The lightweight library for compress image, video, and audio with an awesome experience

Would you like to support me? react-native-compressor Compress videos, images and audio before upload react-native-compressor package is a set of func

Shobbak 265 Jan 1, 2023
Presti 5 Nov 19, 2022
Sample serverless application written in Java compiled with GraalVM native-image

Serverless GraalVM Demo This is a simple serverless application built in Java and uses the GraalVM native-image tool. It consists of an Amazon API Gat

AWS Samples 143 Dec 22, 2022
A simple app to use Xposed without root, unlock the bootloader or modify system image, etc.

中文文档 Introduction VirtualXposed is a simple App based on VirtualApp and epic that allows you to use an Xposed Module without needing to root, unlock t

VirtualXposed 14k Jan 8, 2023
Shows Image you select on Top of every Window by holding the button you choose

ImageOnTop What it does? Shows Image you select on Top of every Window by holding the button you choose. How to use it? Press a keyboard key you want

null 1 Jan 23, 2022
Convert Journeymap image data into Xaero format for Xaero's minecraft map mod

JMtoXaero JMtoXaero is a tool to convert JourneyMap tiles to regions used by Xaero's World Map Description Reads images from the Journeymap folder Wri

Negative Entropy 14 Dec 21, 2022
Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Tinker Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk. Getting started Add t

Tencent 16.6k Dec 30, 2022
Share food-Android- - Food donation coded in native android with firebase, google maps api and php server xampp

share_food-Android- Instructions: 1. Create a firebase account and link it with the project via google-services.json. 2. This project also uses a XAMP

Abubakar 3 Dec 28, 2021
Simple Android app during a coding night. Just Learning Firebase and Android

KUI-App Simple Android app during a coding night. Just Learning Firebase and Android What we learned: Some basics of Android Basic setup of Firebase:

Kibabii University Informatics Club (KUI) 7 Aug 28, 2022
This app brings Privacy dashboard features from Android 12 to older android devices.

PrivacyDashboard This app brings Privacy dashboard features from Android 12 to older android devices. Have you ever thought which apps are accessing y

Rushikesh Kamewar 234 Jan 7, 2023
A complete and performing library to highlight text snippets (EditText, SpannableString and TextView) using Spannable with Regular Expressions (Regex) for Android.

Highlight A complete and performing library to highlight text snippets (EditText/Editable and TextView) using Spannable with Regular Expressions (Rege

Irineu A. Silva 16 Dec 22, 2022