phonegap / phonegap-cli

PhoneGap and PhoneGap/Build command-line interface
Apache License 2.0
488 stars 157 forks source link

Can not build apk because of insufficient Java Heap Space. #813

Open qroft opened 4 years ago

qroft commented 4 years ago

I can not create my app as it contains thousands (!) of images (approx. 2.8GB in total ) and the build process stops by informing me that it has a Java Heap Space problem. For the last days i have read everything about Java Heap Space and added several gradle.properties files to my projcect's root, sub folder Android etc. but the strange thing is that even with these files inside, the Phonegpa ClI shows me this info:

Running command: cmd "/s /c "C:\phonegaps\remgif\platforms\android\gradlew.bat cdvBuildRelease -b C:\phonegaps\remgif\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m""

So even if i change the Xmx to 4g (my PC has 8 GB of RAM), the command "phonegap build -release android -d" always seems to use the 2048MB

As soon as i delete three folders with hundreds of images inside, the APK is created. So i am wondering is this is a RAM or APK max size problem !?

PhoneGap CLI, node & npm versions

Phonegap 8.2.2. Node 8.11.3 NPM 6.10.0

Expected Behaviour

APK gets build

Actual Behaviour

Build stopped due to "Java Heap Space" fail

Steps to Reproduce

phonegap build -release android

Sample Code that illustrates the problem

n.A.

Error messages

qroft commented 4 years ago

[UPDATE] I removed all the images and build the app - everything is fine. After searching around i tried this solution:

When i now try to zipalign -v 4 app-unsigned.zip hello.apk i get this error: Unable to open 'app-unsigned.apk' as zip archive

What i now have found out: zipalign does not like files bigger than 2gb :(