In the Xamarin Android app I'm making, I have a service that processes files. But when it's reading a file that is taking too much memory, it crashes the app, without any exception.
Is there a way to gracefully let the user know that this files is too large.
What I could do is determine the size of the file beforehand, but it depends on the device's memory how much it can handle, right?
Any help or suggestion is welcome :)
Since I can't see your code, so here just some advice, you could run your Xamarin.Android project with a larger heap size.
You could refer to this question . As JonathanPryor said, you can provide the $(JavaMaximunHeapSize)
and $(JavaOptions)
MSBuild
properties to let Java allocate enough memory to complete your build.
You can do this by hand-editing your .csproj
and adding the following section:
<PropertyGroup>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
</PropertyGroup>
Click your project Properties
-> Android Options
-> Advanced
-> Java Max Heap Size
, set the value with "1G".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.