My app keeps crashing with Error: java.lang.OutOfMemoryError:…Please how do I resolve this
Were you able to get a stack trace from the console log?
Also is the issue happening on different pages or when you are doing a particular function?
The first question should be if you are using Images?
no please, the only images am using is my logo and background pattern file of size 4.10 kb
Then you have to paste whole stacktrace here and describe some background. What you have to do in your app to reproduce problem?
Java applications are only allowed to use a limited amount of memory. This limit is specified during application startup. Java heap space indicates object could not be allocated in the Java heap. With -Xmx you can configure more memory for you JVM. To be sure that you don’t leak or waste memory.
Starting a JVM like below will start it with 256MB of memory, and will allow the process to use up to 2048MB of memory:
java -Xmx2048m -Xms256m
While the post is valid for the most part, the example is absolutely irrelevant in the context of Android applications and spawning JVMs with distinct limitations, since this is managed by the system in Android, and is not dictated the user, or the developer.