我让我的应用程序在后台,切换许多应用程序,然后返回我的应用程序。我的应用程序冻结,并得到了内存错误,因为导航,.......
java.lang.OutOfMemoryError: Failed to allocate a 24 byte allocation with 77088 free bytes and 75KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
at java.util.HashMap.newNode(HashMap.java:1746)
at java.util.HashMap.putVal(HashMap.java:630)
at java.util.HashMap.put(HashMap.java:611)
at java.util.HashSet.add(HashSet.java:219)
at java.util.Collections.addAll(Collections.java:5458)
at com.google.android.play.core.splitinstall.zzs.zzh(com.google.android.play:core@@1.10.3:13)
at com.google.android.play.core.splitinstall.zzs.zzc(com.google.android.play:core@@1.10.3:2)
at com.google.android.play.core.splitinstall.zzaa.getInstalledModules(com.google.android.play:core@@1.10.3:1)
at com.google.android.play.core.splitinstall.zzl.getInstalledModules(com.google.android.play:core@@1.10.3:1)
at androidx.navigation.dynamicfeatures.DynamicInstallManager.needsInstall(DynamicInstallManager.kt:100)
at androidx.navigation.dynamicfeatures.DynamicIncludeGraphNavigator.onRestoreState(DynamicIncludeGraphNavigator.kt:158)
at androidx.navigation.NavController.onGraphCreated(NavController.kt:1114)
at androidx.navigation.NavController.setGraph(NavController.kt:1086)
at androidx.navigation.NavController.setGraph(NavController.kt:1039)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.kt:155)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:3090)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:142)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:136)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:248)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:227)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1073)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1001)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
at vn.com.vndirect.stocks.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:44)
at vn.com.vndirect.stocks.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:38)
at vn.com.vndirect.stocks.MainActivity.onCreate(MainActivity.kt:56)
at android.app.Activity.performCreate(Activity.java:8051)
at android.app.Activity.performCreate(Activity.java:8031)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3796)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
我不知道为什么它的内存。请帮助我,谢谢
1条答案
按热度按时间yc0p9oo01#
将以下内容添加到
<application>
中的清单文件中它将在某些环境中工作。在大多数情况下,它是由在应用程序中使用大图像引起的。我建议您调整图像大小,以避免由于内存中的巨大位图而导致的
OutOfMemoryError
错误。