question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using placeholder with progressive image throws java.lang.OutOfMemoryError

See original GitHub issue
<com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/post_img"
            android:layout_width="match_parent"
            android:layout_height="240dp"
            android:layout_gravity="center_horizontal"
            android:adjustViewBounds="true"
            android:maxHeight="240dp"
            android:visibility="visible"
            fresco:actualImageScaleType="fitCenter"
            fresco:placeholderImage="@drawable/img_placeholder" />

Uri mUri = Uri.parse(mUrl);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(mUri)
                .setProgressiveRenderingEnabled(true)
                .build();
        DraweeController mController = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(mSimpleDraweeView.getController())
                .build();
        mSimpleDraweeView.setController(mController);

placeholderImage size : 7kb

Caused by java.lang.OutOfMemoryError

dalvik.system.VMRuntime.newNonMovableArray (VMRuntime.java)
android.graphics.BitmapFactory.nativeDecodeAsset (BitmapFactory.java)
android.graphics.BitmapFactory.decodeStream (BitmapFactory.java:613)
android.graphics.BitmapFactory.decodeResourceStream (BitmapFactory.java:446)
android.graphics.drawable.Drawable.createFromResourceStream (Drawable.java:988)
android.content.res.Resources.createFromResourceStream (Resources.java:2822)
android.content.res.Resources.loadDrawableForCookie (Resources.java:2523)
android.content.res.Resources.loadDrawable (Resources.java:2421)
android.content.res.MiuiResources.loadDrawable (MiuiResources.java:393)
android.content.res.Resources.getDrawable (Resources.java:805)
android.content.res.Resources.getDrawable (Resources.java:770)
com.facebook.drawee.generic.GenericDraweeHierarchyInflater.getDrawable (GenericDraweeHierarchyInflater.java:227)
com.facebook.drawee.generic.GenericDraweeHierarchyInflater.updateBuilder (GenericDraweeHierarchyInflater.java:116)
com.facebook.drawee.generic.GenericDraweeHierarchyInflater.inflateBuilder (GenericDraweeHierarchyInflater.java:77)
com.facebook.drawee.view.GenericDraweeView.inflateHierarchy (GenericDraweeView.java:58)
com.facebook.drawee.view.GenericDraweeView. (GenericDraweeView.java)
com.facebook.drawee.view.SimpleDraweeView. (SimpleDraweeView.java)
java.lang.reflect.Constructor.newInstance (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:288)
android.view.LayoutInflater.createView (LayoutInflater.java:611)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:747)
android.view.LayoutInflater.rInflate (LayoutInflater.java:810)
android.view.LayoutInflater.rInflate (LayoutInflater.java:813)
android.view.LayoutInflater.inflate (LayoutInflater.java:508)
android.view.LayoutInflater.inflate (LayoutInflater.java:418)
com.yappily.adapter.PostDetailAdapter.onCreateViewHolder (PostDetailAdapter.java:83)
android.support.v7.widget.RecyclerView$Adapter.createViewHolder (RecyclerView.java:5779)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5003)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:4913)
android.support.v7.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2029)
android.support.v7.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1414)
android.support.v7.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1377)
android.support.v7.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:578)
android.support.v7.widget.RecyclerView.dispatchLayoutStep2 (RecyclerView.java:3260)
android.support.v7.widget.RecyclerView.dispatchLayout (RecyclerView.java:3069)
android.support.v7.widget.RecyclerView.onLayout (RecyclerView.java:3518)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.support.v4.widget.SwipeRefreshLayout.onLayout (SwipeRefreshLayout.java:598)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.RelativeLayout.onLayout (RelativeLayout.java:1077)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.RelativeLayout.onLayout (RelativeLayout.java:1077)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:579)
android.widget.FrameLayout.onLayout (FrameLayout.java:514)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1703)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1557)
android.widget.LinearLayout.onLayout (LinearLayout.java:1466)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:579)
android.widget.FrameLayout.onLayout (FrameLayout.java:514)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1703)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1557)
android.widget.LinearLayout.onLayout (LinearLayout.java:1466)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:579)
android.widget.FrameLayout.onLayout (FrameLayout.java:514)
android.view.View.layout (View.java:15691)
android.view.ViewGroup.layout (ViewGroup.java:5039)
android.view.ViewRootImpl.performLayout (ViewRootImpl.java:2116)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1873)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1091)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:5926)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:775)
android.view.Choreographer.doCallbacks (Choreographer.java:588)
android.view.Choreographer.doFrame (Choreographer.java:558)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:761)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5276)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:908)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:703)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
erikandrecommented, Jul 12, 2018

Closing older, stale issues. We don’t have enough information to proceed.

0reactions
crosslecommented, Aug 9, 2017

facing same problem, also set use largeHeap, still crash

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve java.lang.OutOfMemoryError trouble in Android
I was loading a ~350kB image in an imageview directly via XML ( app:srcCompat ) which was resulting in OOM error and the...
Read more >
Progressive Image Loading and IntersectionObserver - Medium
Is a technique to smartly load the images of your app by demand, using small placeholders while the original image is being lazy...
Read more >
Changelog Archive - Jenkins
See the Docker images use Java 11 by default blog post for more details. Replace the term "master" with "controller" (for the main...
Read more >
react native: How to set Image defaultSource on Android – iTecNote
I need to set the placeholder Image. Best Solution. I have tried using @Ravi Raj's answer but seems not related to failure on...
Read more >
Blurhash: A compact representation of a placeholder for an ...
These blurry images look like they are composed of a couple of ... why I would want to use this instead of progressive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found