chrisjenx / Calligraphy

Custom fonts in Android the easy way...
Apache License 2.0
8.59k stars 1.09k forks source link

Crash due to OOM in rooted devices #419

Closed iad24 closed 5 years ago

iad24 commented 6 years ago

It happens a lot and can be in any activity

java.lang.OutOfMemoryError: Failed to allocate a 98848344 byte allocation with 16777216 free bytes and 16MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:747) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:568) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1014) at android.content.res.Resources.loadDrawableForCookie(Resources.java:3747) at android.content.res.Resources.loadDrawable(Resources.java:3620) at android.content.res.TypedArray.getDrawable(TypedArray.java:762) at android.widget.ImageView.(ImageView.java:151) at android.widget.ImageView.(ImageView.java:140) at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:72) at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:68) at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106) at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024) at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$WrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:280) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:732) at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) at android.view.LayoutInflater.inflate(LayoutInflater.java:511) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60) at android.view.LayoutInflater.inflate(LayoutInflater.java:415) at android.view.LayoutInflater.inflate(LayoutInflater.java:366) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) at com.xxx.modules.login.views.LoginActivity.onCreate(LoginActivity.kt:38) at android.app.Activity.performCreate(Activity.java:6289) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767) at android.app.ActivityThread.access$900(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

basicodemine commented 5 years ago

any solutions ?

mhoseini967 commented 5 years ago

I have a similar problem

chrisjenx commented 5 years ago

Nothing to do with Calligraphy, either your font is too large or your device ran out of memory while inflating.

chrisjenx commented 5 years ago

Look at the stack trace, try using smaller drawables!