Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6315] Titanium using wrong javac & dx max memory

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDone
Resolution Date2019-11-03T21:18:44.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelstitanium
ReporterYahya Uddin
AssigneeShak Hossain
Created2019-07-20T21:43:55.000+0000
Updated2019-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)

Comments

  1. Rakhi Mitro 2019-07-22

    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.
  2. Yahya Uddin 2019-07-22

    Yes this occurred on v8.0.2.GA on an hello world app.
  3. Ewan Harris 2019-07-22

    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 being android.javac.maxMemory, I believe that's why it failed to work as a config setting for you.
  4. Rakhi Mitro 2019-08-08

    Hello [~yahya12], Hope you are doing fine today.Would you please reply us regarding previous reviews? We are looking forward to your response.
  5. Sharif AbuDarda 2019-08-23

    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.
  6. Brian Immel 2019-08-23

    Is this the document you're looking for? https://wiki.appcelerator.org/display/guides2/Titanium+CLI+Options#TitaniumCLIOptions-android.javac.maxmemory
  7. Yahya Uddin 2019-08-25

    @Rakhi Mitro Sorry for the very late reply. What did you want me to reply to exactly?
  8. Rakhi Mitro 2019-08-26

    [~yahya12], Did you manage to check Ewan's comment? Is it helpful for you?
  9. Ewan Harris 2019-08-26

    [~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?
  10. Yahya Uddin 2019-08-27

    @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.
  11. Sharif AbuDarda 2019-11-03

    Looking into the https://wiki.appcelerator.org/display/guides2/Titanium+CLI+Options#TitaniumCLIOptions-android.javac.maxmemory the docs has been updated. Closing this. Thanks.

JSON Source