0

我是安卓新手。我发布了我的第一个应用程序。我在几台设备上测试了我的应用程序。它工作正常。我发表了它。下载了 40 次,我收到了 3 份崩溃报告。我无法弄清楚我错在哪里?以及如何修复它们?还是我应该修?崩溃报告是否意味着程序已停止工作?提前致谢。

我的报告:

LGE V20 (elsa), 4096MB RAM, Android 7.0
Report 1 of 1
java.lang.OutOfMemoryError: 
  at dalvik.system.VMRuntime.newNonMovableArray (Native Method)
  at android.graphics.BitmapFactory.nativeDecodeAsset (Native Method)
  at android.graphics.BitmapFactory.decodeStream (BitmapFactory.java:620)
  at android.graphics.BitmapFactory.decodeResourceStream (BitmapFactory.java:455)
  at android.graphics.drawable.Drawable.createFromResourceStream (Drawable.java:1152)
  at android.content.res.ResourcesImpl.loadDrawableForCookie (ResourcesImpl.java:855)
  at android.content.res.ResourcesImpl.loadDrawable (ResourcesImpl.java:706)
  at android.content.res.Resources.getDrawable (Resources.java:776)
  at android.content.Context.getDrawable (Context.java:525)
  at android.widget.ImageView.resolveUri (ImageView.java:840)
  at android.widget.ImageView.setImageResource (ImageView.java:439)
  at com.taishi.flipprogressdialog.FlipProgressDialog$1.run (FlipProgressDialog.java:181)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6247)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:872)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:762)

Umx(Ultimate Mobile Experience) U673C (U673C), 1024MB RAM, Android 6.0
Report 1 of 1
java.lang.IllegalStateException: 
  at android.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:1411)
  at android.app.FragmentManagerImpl.enqueueAction (FragmentManager.java:1429)
  at android.app.BackStackRecord.commitInternal (BackStackRecord.java:687)
  at android.app.BackStackRecord.commit (BackStackRecord.java:663)
  at android.app.DialogFragment.dismissInternal (DialogFragment.java:301)
  at android.app.DialogFragment.dismiss (DialogFragment.java:267)
  at com.example.genesis.policeradiostream.TopFeedsFragment$Listeleme.onPostExecute (TopFeedsFragment.java:172)
  at com.example.genesis.policeradiostream.TopFeedsFragment$Listeleme.onPostExecute (TopFeedsFragment.java:95)
  at android.os.AsyncTask.finish (AsyncTask.java:651)
  at android.os.AsyncTask.access$500 (AsyncTask.java:180)
  at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:668)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:5417)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)

Samsung Galaxy S5 (klteusc), 2048MB RAM, Android 6.0
Report 1 of 1
java.lang.OutOfMemoryError: 
  at com.google.android.exoplayer2.extractor.DefaultTrackOutput$InfoQueue.commitSample (DefaultTrackOutput.java:920)
  at com.google.android.exoplayer2.extractor.DefaultTrackOutput.sampleMetadata (DefaultTrackOutput.java:536)
  at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.readSample (Mp3Extractor.java:226)
  at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.read (Mp3Extractor.java:189)
  at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load (ExtractorMediaPeriod.java:652)
  at com.google.android.exoplayer2.upstream.Loader$LoadTask.run (Loader.java:295)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
  at java.lang.Thread.run (Thread.java:818)
4

1 回答 1

2

错误 1 ​​和 3 基本上是 Android 系统告诉您的程序,您的程序要求的位图或某些视频文件的内存量无法分配。当您尝试将大文件加载到内存中时,通常会发生这种情况。有很多方法可以避免这种情况发生,例如:确保仅以将要显示的分辨率加载图像。在 100px*100px 的视图中加载 1920px * 1080px 的图像是没有意义的。

而当您在销毁某些活动或片段元素后访问它时会发生 2。确保您没有访问与 asynctask 的 onPostExecute 方法中的活动或片段相关的任何内容。其他方法是在活动或片段被破坏时取消您的异步任务。

于 2017-10-17T18:41:47.103 回答