单击任何类时,我的Android移动应用程序崩溃,错误显示如下

时间:2017-01-05 14:24:30

标签: android error-handling

这是显示的错误,我不知道它是什么

  E/UncaughtException: java.lang.OutOfMemoryError
                             at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                             at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
                             at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                             at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:817)
                             at android.content.res.Resources.loadDrawable(Resources.java:2854)
                             at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                             at android.view.View.<init>(View.java:3522)
                             at android.widget.ImageView.<init>(ImageView.java:120)
                             at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
                             at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
                             at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                             at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
                             at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
                             at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:681)
                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
                             at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
                             at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                             at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                             at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                             at com.ankoun.alex.sample3.ministry.onCreate(ministry.java:19)
                             at android.app.Activity.performCreate(Activity.java:5283)
                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
                             at android.app.ActivityThread.access$700(ActivityThread.java:150)
                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
                             at android.os.Handler.dispatchMessage(Handler.java:99)
                             at android.os.Looper.loop(Looper.java:137)
                             at android.app.ActivityThread.main(ActivityThread.java:5283)
                             at java.lang.reflect.Method.invokeNative(Native Method)
                             at java.lang.reflect.Method.invoke(Method.java:511)
                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
                             at dalvik.system.NativeStart.main(Native Method)
    D/FA: Logging event (FE): _ae, Bundle[{_o=crash, timestamp=1483625788005, fatal=1}]
    V/FA: Using measurement service
    V/FA: Connection attempt already in progress
    E/AndroidRuntime: FATAL EXCEPTION: main
                      java.lang.OutOfMemoryError
                          at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                          at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
                          at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                          at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:817)
                          at android.content.res.Resources.loadDrawable(Resources.java:2854)
                          at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                          at android.view.View.<init>(View.java:3522)
                          at android.widget.ImageView.<init>(ImageView.java:120)
                          at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
                          at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
                          at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                          at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
                          at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
                          at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:681)
                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
                          at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
                          at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                          at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                          at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                          at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                          at com.ankoun.alex.sample3.ministry.onCreate(ministry.java:19)
                          at android.app.Activity.performCreate(Activity.java:5283)
                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
                          at android.app.ActivityThread.access$700(ActivityThread.java:150)
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
                          at android.os.Handler.dispatchMessage(Handler.java:99)
                          at android.os.Looper.loop(Looper.java:137)
                          at android.app.ActivityThread.main(ActivityThread.java:5283)
                          at java.lang.reflect.Method.invokeNative(Native Method)
                          at java.lang.reflect.Method.invoke(Method.java:511)
                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
                          at dalvik.system.NativeStart.main(Native Method)
    W/ActivityThread: ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
    E/FirebaseCrash: Error sending crash report
                     bnr: Server did not receive report: Origin Error message: Mobile Crash and Performance Reporting API has not been used in project ankoun-154421 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilecrashreporting.googleapis.com/overview?project=ankoun-154421 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
                         at bob.a(:com.google.android.gms.DynamiteModulesC:1053)
                         at boh.a(:com.google.android.gms.DynamiteModulesC:5055)
                         at boh.run(:com.google.android.gms.DynamiteModulesC:54)
                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
                         at java.lang.Thread.run(Thread.java:856)

我的应用程序位于Play商店,它在20%的手机上运行,​​但在所有其他手机上崩溃,这可能是导致崩溃的错误请帮助

3 个答案:

答案 0 :(得分:1)

可能是因为大位图。压缩位图或在Manifest中执行如下操作:

<application
   ...
   android:largeHeap="true"
   ...>

</application>
希望能帮到你!

答案 1 :(得分:0)

您正在解码的图像可能太大了。您可以发布您的代码以及资产有多大?

答案 2 :(得分:0)

您在应用中使用的图片或图标,可能是大尺寸或高分辨率,请将它们缩小尺寸。