I’m trying to compile an Android application that depends on OrmLite and whatever I do I still receive the OutOfMemory error.
The reason why I think Maven doesn’t pass any arguments regarding the heap size is I can only see the following in its output:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar /Users/mikhail.borozdin/android-sdk-macosx/platform-tools/lib/dx.jar –dex –output=/Users/mikhail.borozdin/Documents/workspace/AndroidOrmLiteTest/target/classes.dex
How did I try to pass arguments to JVM?
- export MAVEN_OPTS=-Xmx2048m
- mvn -X install -DargLine=”-Xmx2048m”
- Setting for my plug-in in pom.xml
- Setting for my plug-in in pom.xml
Neither of these worked.
If the project you’re building is using the android-maven-plugin, you want to set the dex mojo configuration in the maven pom.xml file, eg:
Here’s an example from a complete pom.xml file:
https://github.com/rtyley/agit/blob/a014c970/pom.xml#L116-121
Note that the specific xml for dex configuration evolved a fair bit in the run-up to release of android-maven-plugin version 3.0.0 (which has lots of other crucial improvements) – I would recommend ensuring that you are using this version and that the configuration is definitely using the
<dex>node.The android-maven-plugin will use a 1GB heap by default in versions post-v3.0.0 (not yet released at the time of writing).