Appcelerator’s Titanium Mobile Kitchen Sink – a how to

So, I’ve been having a really hard time getting the Kitchen Sink app to load in an emulator using Appcelerator’s Kitchen Sink, I have been hacking away for 4 days now thinking I screwed up my installation guide I just spent 3 weeks working on, when I finally figured out some solutions! Now I cannot take complete credit for this, as I did get a lot of my information from developer.appcelerator.com/questions/created and appcelerator.lighthouseapp.com/projects/32238/tickets I have combined the results of 9 or 10 different posts along with some other tweaks I have made (and updated in my installation guide), and finally an astute observation on my part, to get this to work. So, if you have followed my guide then there is not too much more to do, if you are having this problem and did not follow my guide, then go ahead and give these fixes a try, then check out posts 1-4 with Ubuntu 10.10 32-bit and see if you missed anything.

Here is what I was receiving when I tried launching the kitchen sink before.


[INFO] Launching Android emulator...one moment
[INFO] Creating new Android Virtual Device (2 WVGA800)
[ERROR] Exception occured while building android project:
[ERROR] Traceback (most recent call last):
[ERROR] File "/opt/titanium/mobilesdk/linux/1.6.0/android/builder.py", line 1622, in
[ERROR] s.run_emulator(avd_id, avd_skin)
[ERROR] File /opt/titanium/mobilesdk/linux/1.6.0/android/builder.py", line 348, in run_emulator
[ERROR] avd_name = self.create_avd(avd_id,avd_skin)
[ERROR] File /opt/titanium/mobilesdk/linux/1.6.0/android/builder.py", line 318, in create_avd
[ERROR] inifilec = open(inifile,'r').read()
[ERROR] IOError: (Errno 2] No such file or directory: '/home/sdk/.titanium/avd/titanium_2_WVGA800.avd/config.ini
[INFO] Building KitchenSink for Android ... one moment
[ERROR] JDK version detected, but 1.6 is required

Very confusing output, I have been concentrating on the file line as my main issue, and the ADV errors I was hoping would resolve themselves afterwards. I made a few changes to my guide while trying to resolve this, nothing made it worse! hopefully some of it helped though!

***update on this (really only 45 minutes later), I have resolved most of this issue! I created several AVDs with the name and specifications that the emulator was looking for and the AVD launched the KitchenSink! here are the steps to resolve this issue! This requires some pre-configuration on your part to work, I’ll add notes for steps I remember this on.

  1. android – launches /opt/[android-sdk folder]/tools/android
    1. click new
    2. name=titanium_2_WVGA800 – change the number “2” to what ever number is there in your DEBUG log [DEBUG] AVD ID: #
    3. give it an SD card of some size (I used 25MB)
    4. target set to whatever Google API you want to use (just make sure it is greater than or equal to 1.6)
    5. click “create AVD”
  2. go back to Titanium
  3. select kitchen sink under the projects column on the left
  4. click the edit tab
  5. change the Titanium SDK to 1.2 (not 1.6!!)
  6. now go to test & package
  7. set the SDK to any Android SDK
  8. change the filter to trace
  9. click launch

now try and launch the KitchenSink (my AVD loaded in less than 3 minutes, was not locked and my VM went up to 430MB of RAM and peaked at 45% and 100% on the two CPU cores). It seems the Titanium SDK 1.6 is causing all the issues. I figured this out when it struck me the version is 1.0 (Titanium default starting version)and the date is 2009, Titanium SDK 1.6 was just released, so it has to be the incorrect version!


So the next issue is the last line of the code output above: JDK version detected, but 1.6 is required
I’m still working on this one, so I’ll post it in another post a little bit later after I get it figured out, but right now the Emu is running, the apps in it run, and I think this will allow me and you to start coding!

*** update – I found the prereq.py script located in three locations (might be why when some users replaced it with the modified one in the forum it still didn’t work, as they put it in the wrong place!

  • /opt/titanium/mobilesdk/linux/[ver]/[platform]
    1. 1.6.0/android
    2. 1.6.0/iphone
    3. 1.2.0/android

first thing I did after finding nothing online when searching was to backup the file
sudo cp /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.py /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.py.bak && sudo cp /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.pyc /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.pyc.bak
and then I edited the file to try and fix it! I tried putting my $JAVA_HOME variable before the command “javac” but that returned no JDK installed instead of wrong version, so I tried putting the path to the jdk link in there (/opt/java/jdk-linked/bin/javac) and that returned this line:
JDK version 1.6.0_21 detected, but 1.6 is required
this told me right away that prereq.py is no longer valid and needs to be updated, again, slack programming by a “professional” development company, maybe they need to stop using their Unix wannabe Mac systems and actually use Linux… so I made another change to the file so that it was looking for exactly what it found (this could be dangerous, as it invalidates the check; however I have manually verified that everything is good, and my AVD runs fine at this point, so the only issue is that this python script is bogus. Someone who actually knows python can step in and tell me what I need to put if they would like).

  • sudo vi /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.py – you may need to make changes if you are using windows or OS X to that location, and edit it with a different editor (do a find on the prereq.py file, that is what I did to find it)
  • 17G – using VI as your editor, this will jump you to line 17, the one we need to edit, it is the one that has javac on it and does not have cmd.exe (that would be the windows users line)
  • 9ww – that should skip you up to the “j” in javac
  • i – leaves command mode and begins edit mode inserting the cursor before the “j” in javac
  • /opt/java/jdk-linked/bin/ – the location to javac, if you did not follow my guide to set this up you will need to edit that line based off of where you installed the JDK, when in doubt do a find for javac
  • [esc] – that will take us out of edit mode and back into command mode (also moves the cursor back one space, never figured that out myself…)
  • 4j – that will move us down four lines to the “if not version.startswith…” line
  • use the “h” and “l” keys to move left and right until the cursor is on top of the 6 and type the following a.0_21[esc] – that should have changed the 1.6 to 1.6.0_21 (you should change this to what ever is displayed when you type “javac -version” from the command line!), for example my install is showing 1.6.0_21, therefore my entire line looks like this:
    • if not version.startswith(“1.6.0_21”):
  • :wq! – this will save the change and quit
  • sudo /opt/titanium/mobilesdk/linux/1.6.0/android/prereq.py – should not give that error anymore; it did however display the path to my android sdk home directory (/opt/android-sdk)
  • the prereq.pyc file is the compiled version of prereq.py, hopefully it will be updated automatically, but we made a backup earlier just in case.


    This next issue appears to have been resolved by one of the solutions I found above. I am posting it here anyway, in case someone else has run into issues with this and does a search, hopefully they will find this post as a resolution.


    [TRACE] wait_for_device returned: List of devices attached
    [TRACE]
    [TRACE]
    [DEBUG] /opt/android-sdk/tools/adb -e devices

    This just keeps repeating in the window over and over, I have let it sit for 30 minutes and it just keeps going about one repetition per second. If I re-click the “launch” button it does it maybe 4 times before building the kitchen sink, then it does some other things, builder.py line 803 – , line 622 – build and run, and line 112 – wait_for_device, then time.sleep(1) and KeyboardInterrupt and then it just stops there, if I re-launch it goes back to just repeating the above code, it is not a perfect loop, sometimes it will do the repeating over and over a couple of launch clicks in a row before going back to the builder.py lines.

    For what it’s worth, I get the exact same issue (with the same resolutions) if I create a new project and try to run it with Titanium’s SDK 1.6.0. Now one of the forum posts on developer.appcelerator.com stated that 1GB of RAM was not enough to use Titanium and that they have a 4GB win XP machine that normally uses ~2.6GB when they have Titanium running. so with out checking first, I shutdown my VM and bumped the RAM up to 2GB (from 1GB) and then started it up again and launched System Monitor, then tried building the KitchenSink and a blank new app called testapp1. My Linux Ubuntu 10.10 32-bit Virtual Machine with 2 CPU cores assigned, was using a whopping 201MB of RAM and the two cores were at 12.4% and 16.2% utilization. From this we can infer that either absolutely nothing is happening, or somebody is full of it. (I’m thinking the system is just sitting idle and not doing anything myself…).

    Now, I know that VM’s work better with less resources assigned to them, and only increasing those levels if the system is pushing it’s limits. So, I decided to cut it back to 512MB of RAM and 1 CPU core to see what happens (I also shut down the 3 other VMs I had running on my machine).

    *** solution – I believe that creating the AVD with the name that Titanium was looking for resolved this 3rd problem for me, as it is no longer occurring. Additionally, (and I have updated my installation guide to match) I have found that my Ubuntu VM runs about 450MB of RAM and 1 CPU core at 100% with another at >25% when the AVD is running. So, I have adjusted my VM to 768MB of RAM total (originally I was using 1GB, then I upped it to 2GB) and 2 CPU cores (no change there). I have not had any issues with maxing out those resources and so far the VM has used 0KB of swap.

    I have been having some other issues, and they will be coming in a follow-up post to this one (as a hint, I have resolved the libenchant error messages already, but detected another one in the meantime that I am still working on).

About

Leave a Reply

1 visitors online now
0 guests, 1 bots, 0 members
Max visitors today: 4 at 02:46 am UTC
This month: 44 at 06-03-2020 03:58 am UTC
This year: 80 at 02-23-2020 11:52 pm UTC
All time: 1100 at 08-08-2011 08:11 pm UTC