stephentuso/welcome-android

App crashes after the 16th screen

KevinMinions opened this issue · 4 comments

I'm using welcome-android to create a slideshow gathering all the things my wife loves.
There are 36 pages, and I'm using almost all page example model included in welcome-android.
Until now, I used only photo.png provided in welcome-android https://github.com/stephentuso/welcome-android/blob/master/sample/src/main/res/drawable/photo.png, and I could see the whole slideshow without any issue.

Now, I replace "photo.png" with resized photos/clipart (500x500px & transparent background), and here is my problem/issue : App crashes after the 16th screen.

Here is my logcat : http://pastebin.com/LfDkGTag

Glad you brought this up, I've never tested it with that many pages. The crash is because it's running out of RAM:

Throwing OutOfMemoryError "Failed to allocate a 12250012 byte allocation with 8930112 free bytes and 8MB until OOM"

However, that could be due to the size of your images (that's 12 MB), I think loading a bitmap is the only thing that would take up that much space after the app has already started, make sure all your images are resized/optimized correctly. This was more intended to be used with SVGs and simpler PNGs, if these are photographs they will probably need to be compressed quite a bit. Within the next week I can look into optimizing it to use memory more efficiently though.

Thank you for your answer Stephen Tuso

I was having this problem too until I read this answer: https://stackoverflow.com/questions/19196616/is-there-a-way-to-create-xxhdpi-xhdpi-hdpi-mdpi-and-ldpi-drawables-from-a-lar

Steps to reproduce:

  1. PNG image (88 KB, 1920x1080)
  2. PNG located inside the default "drawable" folder
  3. App would crash because of OutOfMemoryError when moving welcome screen

Solution:

  • Moved the PNG files to the "drawable-xxhdpi" folder

Closing this, task added as #54