[AC-6315] Titanium using wrong javac & dx max memory
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Done |
Resolution Date | 2019-11-03T21:18:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | titanium |
Reporter | Yahya Uddin |
Assignee | Shak Hossain |
Created | 2019-07-20T21:43:55.000+0000 |
Updated | 2019-11-03T21:18:44.000+0000 |
Description
I am running the following command to compile an app for Android:
ti build -p android -T device
The build process runs a bunch of commands. On the bit it builds the java files, on v7.5.1.GA and older, it run a command like so:
javac -J-Xmx1024M -encoding utf8 -bootclasspath ...
But on v7.5.1.GA and greater (tested on v7.5.2 and v8.0.0), the build command used more memory like so, ignoring the default values of 1GB as mentioned on the docs:
javac -J-Xmx3072M -encoding utf8 -bootclasspath ...
This meant when building my app, I get the following unuseful error message (regardless of log-level):
[ERROR] Failed to compile Java source files:
[ERROR]
[ERROR]
(Side note: It would be good to get more information than just this).
When I tried the javac command manually, I found the error:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried adjusting the the amount of memory used like so:
ti config android.javac.maxmemory 1024M
but it's just ignored it, and still uses 3GB instead.
I solved this issue by adding the following properties to tiapp.xml
<property name="android.javac.maxmemory" type="string">1G</property>
<property name="android.dx.maxmemory" type="string">1G</property>
and the javac command changed correctly.
So the issues are:
1. Titanium v7.5.2 and greater does not use the correct memory for javac and dexter
2. When adjusting the config, the memory used in the build does not change
3. Un-useful error message in console output when build fails (this could be a separate issue)
Hello, Thanks for sharing with us. Can you please create a new app, run this on 8.0.2.GA and let us know how it goes.
Yes this occurred on v8.0.2.GA on an hello world app.
This was a known change made in TIMOB-26898, however the docs should have been updated to reflect that. As for the ti config setting not working, it looks like the tiapp and config have different names, with the tiapp being
android.javac.maxmemory
and the config beingandroid.javac.maxMemory
, I believe that's why it failed to work as a config setting for you.Hello [~yahya12], Hope you are doing fine today.Would you please reply us regarding previous reviews? We are looking forward to your response.
Hello [~eharris], can you please share the docs link where we should update the relevant information. I believe [~bimmel], can get on making the change. Thanks.
Is this the document you're looking for? https://wiki.appcelerator.org/display/guides2/Titanium+CLI+Options#TitaniumCLIOptions-android.javac.maxmemory
@Rakhi Mitro Sorry for the very late reply. What did you want me to reply to exactly?
[~yahya12], Did you manage to check Ewan's comment? Is it helpful for you?
[~sdarda], the docs are already up to date for the change that was made. Looking at the wiki page it was made prior to this ticket being filed also so the change should have been live. ? [~yahya12], I believe Rahki is referring to my previous comment. Have you managed to fix this error?
@Ewan Harris @Sharif AbuDarda Yes sorry. I actually mentioned this inconsistency on the GitHub issue: https://github.com/appcelerator/titanium_mobile/issues/11068 . Sorry for the confusion.
Looking into the https://wiki.appcelerator.org/display/guides2/Titanium+CLI+Options#TitaniumCLIOptions-android.javac.maxmemory the docs has been updated. Closing this. Thanks.