Bug #4277

crash on OutOfMemoryError in AccountWizardActivity

Added by Anonymous about 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:12/12/2014
Priority:UrgentDue date:
Assignee:n8fr8% Done:

0%

Category:-
Target version:v14 - Armadillo's Agram
Component:

Description

Looks like the bitmap might be too big, its causing problems, including a crash on the Moto G:

java.lang.RuntimeException: Unable to start activity ComponentInfo{info.guardianproject.otr.app.im/info.guardianproject.otr.app.im.app.AccountWizardActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4036)
at android.app.ActivityThread.access$1000(ActivityThread.java:173)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5579)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at info.guardianproject.otr.app.im.app.AccountWizardActivity.onCreate(AccountWizardActivity.java:120)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
... 12 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
... 24 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:889)
at android.content.res.Resources.loadDrawable(Resources.java:3454)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.<init>(View.java:3694)
at android.view.ViewGroup.<init>(ViewGroup.java:480)
at android.widget.LinearLayout.<init>(LinearLayout.java:176)
at android.widget.LinearLayout.<init>(LinearLayout.java:172)
... 27 more

History

#1 Updated by n8fr8 about 3 years ago

  • Status changed from New to In Progress

The linked fix looks viable. Implemented and testing.

#2 Updated by hans about 3 years ago

These large bitmaps use a ton of memory. They need to be resized for the various ldpi, mdpi, hdpi, etc. so that they don't cause crashes on smaller or older devices.

This bitmap causes a crash every time I try to get past the initial set password screen on my Gingerbread emulator (256megs of RAM). Yes, this is a tiny amount of RAM, but it is good for quickly finding problems like this. On devices with 512 megs of RAM (quite common), ChatSecure will dominate the RAM, causing things like Orbot and other Services to be killed.

        AndroidRuntime  E  FATAL EXCEPTION: main
                        E  java.lang.OutOfMemoryError: bitmap size exceeds VM budget
                        E      at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                        E      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
                        E      at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
                        E      at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
                        E      at android.content.res.Resources.loadDrawable(Resources.java:1709)
                        E      at android.content.res.Resources.getDrawable(Resources.java:581)
                        E      at android.view.View.setBackgroundResource(View.java:7533)
                        E      at info.guardianproject.otr.app.im.app.LockScreenActivity.onCreate(LockScreenActivity.java:116)
                        E      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
                        E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
                        E      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
                        E      at android.app.ActivityThread.access$1500(ActivityThread.java:117)
                        E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
                        E      at android.os.Handler.dispatchMessage(Handler.java:99)
                        E      at android.os.Looper.loop(Looper.java:130)
                        E      at android.app.ActivityThread.main(ActivityThread.java:3683)
                        E      at java.lang.reflect.Method.invokeNative(Native Method)
                        E      at java.lang.reflect.Method.invoke(Method.java:507)
                        E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
                        E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
                        E      at dalvik.system.NativeStart.main(Native Method)

#3 Updated by hans about 3 years ago

Just upped the RAM on my 2.3.3 emulator to 512, and I got a little further, but not even to the main screen before I got this:

        AndroidRuntime  E  FATAL EXCEPTION: main
                        E  java.lang.OutOfMemoryError: bitmap size exceeds VM budget
                        E      at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                        E      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
                        E      at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
                        E      at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
                        E      at android.content.res.Resources.loadDrawable(Resources.java:1709)
                        E      at android.content.res.Resources.getDrawable(Resources.java:581)
                        E      at android.widget.AbsListView.setOverScrollMode(AbsListView.java:655)
                        E      at android.view.View.<init>(View.java:1879)
                        E      at android.view.View.<init>(View.java:1921)
                        E      at android.view.ViewGroup.<init>(ViewGroup.java:292)
                        E      at android.widget.AdapterView.<init>(AdapterView.java:228)
                        E      at android.widget.AbsListView.<init>(AbsListView.java:592)
                        E      at android.widget.ListView.<init>(ListView.java:163)
                        E      at android.widget.ListView.<init>(ListView.java:159)
                        E      at android.widget.ListView.<init>(ListView.java:155)
                        E      at android.support.v4.app.ListFragment.onCreateView(ListFragment.java:122)
                        E      at info.guardianproject.otr.app.im.app.AccountsFragment.onCreateView(AccountsFragment.java:65)
                        E      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
                        E      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:920)
                        E      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
                        E      at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1206)
                        E      at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2159)
                        E      at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
                        E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
                        E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
                        E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
                        E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
                        E      at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
                        E      at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
                        E      at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
                        E      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
                        E      at android.app.Activity.setContentView(Activity.java:1657)
                        E      at info.guardianproject.otr.app.im.app.NewChatActivity.onCreate(NewChatActivity.java:180)
                        E      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
                        E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
                        E      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
                        E      at android.app.ActivityThread.access$1500(ActivityThread.java:117)
                        E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
                        E      at android.os.Handler.dispatchMessage(Handler.java:99)
                        E      at android.os.Looper.loop(Looper.java:130)
                        E      at android.app.ActivityThread.main(ActivityThread.java:3683)
                        E      at java.lang.reflect.Method.invokeNative(Native Method)
                        E      at java.lang.reflect.Method.invoke(Method.java:507)
                        E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
                        E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
                        E      at dalvik.system.NativeStart.main(Native Method)

#4 Updated by hans about 3 years ago

can we skip the decoration update for now? The old locks background was nice. We really need to get this app stable and reliable.

#5 Updated by hans about 3 years ago

Hopefully fixed here:
https://github.com/guardianproject/ChatSecureAndroid/pull/597

I couldn't use chatsecure in any emulator because it kept crashing, so I went ahead and fixed it.

#6 Updated by n8fr8 over 2 years ago

  • Status changed from In Progress to Resolved

#7 Updated by n8fr8 over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF