Reputation: 533
My app is working on my physical device (MotoG3) and emulator(Nexus 5) and passes test on 11 out of 13 devices on Pre-launch crash test on Google Play Developer Console. The two devices it is failing are on Galaxy Note 2 and 3 (Android 4.4) as shown in the image below -
I am not sure what is going wrong, is there any memory leak, if so how to catch that? This is all new to me.
The outOfMemoryError is -
FATAL EXCEPTION: main
Process: com.tdp.tdp, PID: 17269
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
at android.content.res.Resources.loadDrawable(Resources.java:3054)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.widget.ImageView.<init>(ImageView.java:133)
at android.support.v7.widget.au.<init>(Unknown Source)
at android.support.v7.widget.au.<init>(Unknown Source)
at android.support.v7.a.bh.a(Unknown Source)
at android.support.v7.a.as.c(Unknown Source)
at android.support.v7.a.as.a(Unknown Source)
at android.support.v4.view.ak.onCreateView(Unknown Source)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:173)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.thedailypiece.thedailypiece.c.a(Unknown Source)
at android.support.v4.app.n.b(Unknown Source)
at android.support.v4.app.z.a(Unknown Source)
at android.support.v4.app.z.a(Unknown Source)
at android.support.v4.app.e.run(Unknown Source)
at android.support.v4.app.z.e(Unknown Source)
at android.support.v4.app.z.b(Unknown Source)
at android.support.v4.app.ah.b(Unknown Source)
at android.support.v4.view.ViewPager.a(Unknown Source)
at android.support.v4.view.ViewPager.a(Unknown Source)
at android.support.v4.view.ViewPager.a(Unknown Source)
at android.support.v4.view.ViewPager.setCurrentItem(Unknown Source)
at com.github.paolorotolo.appintro.AppIntroViewPager.setCurrentItem(Unknown Source)
at com.github.paolorotolo.appintro.b.onClick(Unknown Source)
at android.view.View.performClick(View.java:4630)
at android.view.View$PerformClick.run(View.java:19339)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Upvotes: 1
Views: 317
Reputation: 3916
The Galaxy Notes have nonstandard dpi configurations. They are probably loading really large bitmaps (or scaling up the ones you've provided). (Why does my Galaxy Note 3 have the same DP dimensions as a much smaller phone?)
You have a few solutions,
Provide all dpi levels of image assets so the system does not have to scale the missing resolutions.
Use an image library, (such as Glide or Picasso) to load the images at the best resolutions.
Most importantly, make sure the files are cut to the correct sizes. Having super large bitmaps is useless if they can't be shown onscreen.
Upvotes: 2
Reputation: 12615
This is pretty happening in every single android app. You have some Image that takes a lot of memory in your AppIntroViewPager
Fragments, so you need to downsample it to not ocuupate all of the app's memory.
You should read this Displaying Bitmaps in Your UI and consider using some image loading library like Picasso, Glide.
Upvotes: 1