简体   繁体   English

Android应用程式上的Java堆大小错误

[英]Java heap size error on android app

I am getting "Java heap size" error when trying to run my app in eclispe. 尝试在eclispe中运行我的应用程序时,出现“ Java堆大小”错误。

For Java applications i know how to set the jvm "-Xms512M -Xmx1524M" args, but how do i do this for Android app? 对于Java应用程序,我知道如何设置jvm“ -Xms512M -Xmx1524M”参数,但是如何为Android应用程序设置呢?

There is no "arguments" tab for android app. android应用没有“参数”标签。

There is one option you can use in manifest. 您可以在清单中使用一个选项。 Add android:largeHeap="true" in you manifest. 在清单中添加android:largeHeap =“ true”。 But it is available in some higher APIs if I am not wrong it is available in 3.0+. 但是如果我没有记错的话,它可以在某些高级API中使用,但在3.0+中可用。 Other things you can do is to never let your app goes out of memory by allocating and deallocating memory with care. 您可以做的其他事情是,不要通过小心分配和释放内存来让应用程序永远不会耗尽内存。

What you can try is to use the android:largeHeap="true" like Khawar Raza said. 您可以尝试使用khawar Raza所说的android:largeHeap =“ true”。 Aswell try to nullify(set objects to null) objects that you dont need anymore so they will be deleted by the garbage Collector. 还要尝试使不再需要的对象无效(将对象设置为null),以便将它们由垃圾收集器删除。

Hope it will work out 希望它能解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM