Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Error - System Error while compiling Android classes.dex

Created a HelloWorld application and after spending 5+ hours trying to resolve this, thought I would try the forums. When I try to run the application in the Android Emulator, receive the message:

[INFO] Compiling Android Resources… This could take some time
[ERROR] System Error while compiling Android classes.dex
[INFO] Android Emulator has exited

Nothing is deployed to the emulator. Here are some details on how I have things setup:

Titanium SDK Directory: /home/user/.titanium/
Titanium SDK Version: 1.7.5
Android SDK Directory: /home/user/TitaniumStudio/sdk/android

Environment Variables:

export PATH=/usr/lib/jvm/java-6-sun-1.6.0.26/bin:/home/user/TitaniumStudio/sdk/android:$PATH
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.26
export android_sdk=/home/user/TitaniumStudio/sdk/android

It's probably really simple, just hoping for some advice on where to look for misconfigurations or suggestions on next steps for troubleshooting.

Thanks

— asked November 9th 2011 by Dave Sepa
  • classes.dex
2 Comments
  • If you start a new empty project (with the code the titanium generates) and run it as it is, do you still get this?

    — commented November 9th 2011 by Ophir 'Shlomi' Oren
  • yes, actually the helloworld application is a new project with nothing added.

    — commented November 9th 2011 by Dave Sepa

2 Answers

  • Resolved the problem. Located the file:
    /home/<myprobile>/.titanium/mobilesdk/linux/1.7.5/android/builder.py

    Changed the line …

    From:
    dex_args = [dx, '-JXmx1524M', '-JXX:-UseGCOverheadLimit']

    To:
    dex_args = [dx, '-JXmx1024M', '-JXX:-UseGCOverheadLimit']

    — answered November 10th 2011 by Dave Sepa
    permalink
    2 Comments
    • So you changed 1524 to 1024. In my builder.py file the initial value is 1536. How did you think to make the change you did?

      — commented November 22nd 2011 by Ross Ekberg
    • More of a lucky guess, walked through the logic in the script, unfortunately it just checks for the existence of classes.dex, if it doesn't exist after a particular operation, it just fails. The memory limit seemed high, thought I would try to tweak it and see what happens, and sure enough it worked.

      — commented November 24th 2011 by Dave Sepa
  • WOW thank you so much. Searched for days to find an answer to this stacktrace. The problem is that I changed TitaniumStudio.ini to use 1024m instead of the default because my machine only has 3GB of memory. So another option is to change /home/me/Titanium_Studio/TitaniumStudio.ini to make sure it has the default memory settings (I think it was 1524m).

    Variations on the same problem:

    [ERROR] Exception occured while building Android project:
    [ERROR] Traceback (most recent call last):
    [ERROR] File "/home/bob/.titanium/mobilesdk/linux/3.0.2.GA/android/builder.py", line 2392, in <module>
    [ERROR] builder.build_and_run(False, avd_id, debugger_host=debugger_host)
    [ERROR] File "/home/bob/.titanium/mobilesdk/linux/3.0.2.GA/android/builder.py", line 2141, in build_and_run
    [ERROR] self.manifest_changed = self.generate_android_manifest(compiler)
    [ERROR] File "/home/bob/.titanium/mobilesdk/linux/3.0.2.GA/android/builder.py", line 1063, in generate_android_manifest
    [ERROR] shutil.copy(icon_path, dest_icon)
    [ERROR] File "/usr/lib/python2.7/shutil.py", line 117, in copy
    [ERROR] copyfile(src, dst)
    [ERROR] File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    [ERROR] with open(src, 'rb') as fsrc:
    [ERROR] IOError: [Errno 2] No such file or directory: u'/home/bob/Titanium_Studio_Workspace/SAO-App/build/android/bin/assets/Resources/appicon.png'
    [ERROR] Application Installer abnormal process termination. Process exit value was 1

    or

    OSError: [Errno 13] Permission denied

    or

    [ERROR] Exception occured while building Android project: [ERROR] Traceback (most recent call last): [ERROR] File "C:\Users\Alessandro\AppData\Roaming\Titanium\mobilesdk\win32\1.7.2\android\builder.py", line 1964, in <module> [ERROR] s.build_and_run(True, avd_id, device_args=device_args) [ERROR] File "C:\Users\Alessandro\AppData\Roaming\Titanium\mobilesdk\win32\1.7.2\android\builder.py", line 1838, in build_and_run [ERROR] launched, launch_failed = self.package_and_deploy() [ERROR] File "C:\Users\Alessandro\AppData\Roaming\Titanium\mobilesdk\win32\1.7.2\android\builder.py", line 1353, in package_and_deploy [ERROR] unsigned_apk = self.create_unsignedapk(ap) [ERROR] File "C:\Users\Alessandro\AppData\Roaming\Titanium\mobilesdk\win32\1.7.2\android\builder.py", line 1278, in create_unsigned_apk [ERROR] apk_zip.write(self.classes_dex, 'classes.dex') [ERROR] File "C:\Users\Alessandro\AppData\Local\Titanium Studio\plugins\com.appcelerator.titanium.python.win32_1.0.0.1312318466\python\lib\zipfile.py", line 541, in write [ERROR] st = os.stat(filename) [ERROR] WindowsError: [Error 2] The system cannot find the file specified:

    — answered February 24th 2013 by bob ferrero
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.