简体   繁体   English

如何以编程方式将android上的JVM增加到10MB?

[英]how to programatically increase the JVM on android to 10MB?

is it possible to programatically increase the JVM android machine to 10MB? 是否可以通过编程将JVM android计算机增加到10MB? If yes can someone post a java code and let me know how to do it? 如果是,有人可以发布Java代码并让我知道该怎么做吗? I have a file of 11MB and I get the error out of memory when I try to parse the file in a string. 我有一个11MB的文件,当我尝试将其解析为字符串时,出现内存不足的错误。 Need help. 需要帮忙。 appreciate 欣赏

UPDATE: 更新:

I've also parse with SAX. 我也使用SAX进行了解析。 Same result. 结果相同。 When adding android:largeHeap=true I have error: No resource identifier found for attribute LargeHeap Any other solutions? 添加android:largeHeap = true时出现错误:找不到属性LargeHeap的资源标识符还有其他解决方案吗?

Can you answer, what exactly you trying to do? 你能回答,你到底想做什么?

If your app targets at honeycomb (android 3.0) and later you can try to set option android:largeHeap="true" in Application tag of your AndroidManifest.xml. 如果您的应用程序定位于honeycomb(android 3.0)及更高版本,则可以尝试在AndroidManifest.xml的Application标签中设置选项android:largeHeap =“ true”。

If you trying to parse JSON or XML, try to streaming aproach instead of tree-based. 如果尝试解析JSON或XML,请尝试流式传输方法,而不是基于树的方法。

UPDATE: In AndroidManifest.xml 更新:在AndroidManifest.xml中

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

You are lucky if have a rooted phone. 如果您拥有一部扎根的手机,您将会很幸运。 You can try change line 你可以试试换线

dalvik.vm.heapsize=24m

in /system/build.props. 在/system/build.props中。

If not, you can try to use the SAX library to parse your XML content. 如果没有,您可以尝试使用SAX库来解析您的XML内容。 It can help to avoid to load full file at time, instead with this library you can load your data by small pieces. 它可以帮助避免一次加载整个文件,而使用此库,您可以按小块加载数据。

ALSO: There are no JVM on android. 另外:Android上没有JVM。 There is Dalvik. 有达尔维克。

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

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