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.

OutOfMemoryError

See original GitHub issue

Version of AppIntro: implementation 'com.github.apl-devs:appintro:v4.2.3'

Phone info: Samsung

  • Model: SM-S327VL
  • Orientation: Portrait
  • RAM free: 209.15 MB
  • Disk free: 4.17 GB

Operating system:

  • Version: 6.0.1
  • Orientation: Portrait
  • Rooted: No

This line was emphasized indicating the cause of error: com.github.paolorotolo.appintro.AppIntroBaseFragment.onCreateView (AppIntroBaseFragment.java:103)

Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 23950092 byte allocation with 16777216 free bytes and 21MB until OOM com.github.paolorotolo.appintro.AppIntroBaseFragment.onCreateView

The complete Log:

android.graphics.BitmapFactory.nativeDecodeAsset (BitmapFactory.java)
android.graphics.BitmapFactory.decodeStream (BitmapFactory.java:856)
android.graphics.BitmapFactory.decodeResourceStream (BitmapFactory.java:675)
android.graphics.drawable.Drawable.createFromResourceStream (Drawable.java:2230)
android.content.res.Resources.loadDrawableForCookie (Resources.java:4282)
android.content.res.Resources.loadDrawable (Resources.java:4156)
android.content.res.Resources.getDrawable (Resources.java:2045)
android.content.res.Resources.getDrawable (Resources.java:2027)
android.content.Context.getDrawable (Context.java:464)
android.support.v4.content.ContextCompat.getDrawable (ContextCompat.java:358)
android.support.v7.widget.AppCompatDrawableManager.getDrawable (AppCompatDrawableManager.java:198)
android.support.v7.widget.AppCompatDrawableManager.getDrawable (AppCompatDrawableManager.java:186)
android.support.v7.content.res.AppCompatResources.getDrawable (AppCompatResources.java:100)
android.support.v7.widget.AppCompatImageHelper.setImageResource (AppCompatImageHelper.java:85)
android.support.v7.widget.AppCompatImageView.setImageResource (AppCompatImageView.java:93)
com.github.paolorotolo.appintro.AppIntroBaseFragment.onCreateView (AppIntroBaseFragment.java:103)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2346)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1428)
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManager.java:1759)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1827)
android.support.v4.app.BackStackRecord.executeOps (BackStackRecord.java:797)
android.support.v4.app.FragmentManagerImpl.executeOps (FragmentManager.java:2596)
android.support.v4.app.FragmentManagerImpl.executeOpsTogether (FragmentManager.java:2383)
android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManager.java:2338)
android.support.v4.app.FragmentManagerImpl.execSingleAction (FragmentManager.java:2215)
android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss (BackStackRecord.java:649)
android.support.v4.app.FragmentPagerAdapter.finishUpdate (FragmentPagerAdapter.java:145)
android.support.v4.view.ViewPager.populate (ViewPager.java:1238)
android.support.v4.view.ViewPager.populate (ViewPager.java:1086)
android.support.v4.view.ViewPager$3.run (ViewPager.java:267)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
android.view.Choreographer.doCallbacks (Choreographer.java:686)
android.view.Choreographer.doFrame (Choreographer.java:619)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:7422)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)```

I use AppIntro in the most standard way: 
    SliderPage sliderPage1 = new SliderPage();
    sliderPage1.setTitle("Welcome!");
    sliderPage1.setDescription("Here's a quick intro.");
    sliderPage1.setImageDrawable(R.drawable.icon1);
    sliderPage1.setBgColor(Color.TRANSPARENT);
    addSlide(AppIntroFragment.newInstance(sliderPage1));
   addSlide(AppIntroFragment.newInstance("Welcome", "Enjoy", R.drawable.icon1, R.drawable.gradient));

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TomTaschecommented, Nov 18, 2018

This is a known issue for devices with lower resolutions. You should scale down your images so the device doesn’t have to do it at runtime. See here for more: https://github.com/paolorotolo/AppIntro/issues/402#issuecomment-439701856

0reactions
AnuthaDevcommented, Feb 23, 2019

Hey @paolorotolo Do you think using fragmentpageradapter/fragmentstatepageradapter in appintrobase could potentially solve this issue(From what I read, one destroys the view hierarchy and another destroys the whole fragment if not in view that could potentially save memory)

Read more comments on GitHub >

github_iconTop Results From Across the Web

OutOfMemoryError (Java Platform SE 7 ) - Oracle Help Center
Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made...
Read more >
Understanding OutOfMemoryError Exception in Java
OutOfMemoryError usually means that you're doing something wrong, either holding onto objects too long or trying to process too much data at a ......
Read more >
OutOfMemoryError - Android Developers
OutOfMemoryError objects may be constructed by the virtual machine as if writable. ... Constructs an OutOfMemoryError with no detail message.
Read more >
OutOfMemoryError exceptions - IBM
The JVM throws a java.lang.OutOfMemoryError exception when the heap is full and the JVM cannot find space for object creation. Heap usage is...
Read more >
Java OutOfMemoryError Exceptions: Causes & Fixes [Tutorial]
A java.lang.OutOfMemoryError means that something is wrong in the application – to be precise there was an issue with a part of application ......
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