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).

Part Four – Installing the Android SDKs and Appcelerator’s Titanium Mobile Developer

Hello and welcome back for part 4 (hopefully the last part!) of how to setup Appcelerator Titanium Mobile Developer on Ubuntu 1010 32-bit. These steps should also work with Titanium Desktop Developer, although you would have to downlaod that instead of the Mobile version, and probably would not want to add the Android SDK. In this final part we will add the Android SDK’s and finally install Titanium, in the previous parts we have configured a clean Ubuntu 10.10 installation so that all dependencies for Android development are installed and ready to go before we start coding. I got destracted and have started another post about getting The Elder Scrolls Arena and Daggerfall working on Android the last couple of days (should have a post on that a day or two after this one is up). And, off we go, lets get this post finished!

  1. sudo mount -a – make sure our shared drives are properly mounted
  2. let’s download the Android SDK and AVD Manager! – http://developer.android.com/sdk/index.html – The currently available download is android-sdk_r10-linux_x86.tgz, if you are using the default firefox that installs with Ubuntu 10.10 it will save it under ~/Downloads if you want to save a step, don’t save it, just open it with the archive manager and extract the contents to ~/Downloads.
  3. back to our friend the terminal sudo mv ~/Downloads/android-sdk-linux_x86/ /opt/android-sdk/ this will allow you to move the SDK plus AVD manager to the /opt directory, remember to use the [tab] key!
  4. cd /opt/android-sdk-linux_x86/tools/ && sudo ./android – this will move us into the directory and launch the AVD manager
  5. select Available Packages from the left column
  6. click the arrow next to Android Repository, this will expand the currently available choices
  7. I will be starting with 2.1; however I will also add 1.6, 2.2, 2.3.3, and 3.0 SDKs at this time, (you need 1.6 because Titanium looks for it by default and won’t let you set your preferences without it) also I am getting all of the samples, as there is no reason to reinvent the wheel, just the method used to turn it!. I also went under third party and grabbed the google api’s for 1.6, 2.1, 2.2, 2.3, 2.3.3, and 3.0 for the same reason, while under the third-party section, make sure to get the two google market Apis at the bottom. I also retrieved the Api 11 documentation (Android 3.0) (if you are interested there is also a samsung galaxy SDK there, but it is only for Android 2.2r1 for some reason)
  8. click on install selected and a new screen pops up
  9. click the “Accept All” radio button and hit install, this might take a bit… mine downloaded at 2.0 – 2.5mb/s so it was under 5 mins to d/l all of it
  10. You will be prompted to restart ADB, you must do so to continue. then close the application window.
  11. vi ~/.profile – edits your start up preferences
    1. [ctrl+f] [ctrl+f] – moves you down two pages, or in this case to the last line of the file
    2. A – starts editing the line from the end
    3. :/opt/android-sdk:/opt/android-sdk/tools:/opt/android-sdk/platform-tools – adds the android SDK directories to your path
    4. [esc] – ends editing and returns you to command mode
    5. :wq! – saves, then quits the vi editor
  12. sudo ln -s /opt/android-sdk/platform-tools/adb /opt/android-sdk/tools/adb – also needed for titanium, until they update to reflect the new home for adb!
  13. cd ~/android/environment/system && sudo wget http://www.appcelerator.com/download-linux32
  14. go to the Places pulldown menu in Ubuntu –> home folder
  15. then when it is open go to android –> environment –> system
  16. right click on the file download-linux32 and selct extract here – when I tested this, the extraction failed, when I went to the website and followed the prompts to get to the download, it downloaded the same file from the same server path and it was the same size, but the extraction worked. just an fyi if you have issues with these steps
  17. cd Titanium\ Developer-1.2.2 && sudo ./Titanium\ Developer – again remember to use the [tab] key after typing the first couple of letters
    1. on the installer screen, click on the “Install to my home directory” and change it to “Install to /opt/titanium”
    2. click Install
    3. after this ends you should get dumped to the terminal window with an error, so now we will fix that error
      1. cd /opt/titanium/runtime/linux/1.0.0 && sudo mkdir backup && mv libg*-2.0.* ./backup/
  18. cd ~/android/environment/system/Titanium\ Developer && sudo ./Titanium\ Developer – use that [tab] key!
  19. after you log in, or sign up, you should get prompted for an update to 1.6 (no idea why it downloads 1.2.2 instead of 1.6 to begin with, but hey, what can you do?), go ahead and get it, remember to install it to /opt/titanium
  20. after which you will be prompted for an update to 1.1.0 for the desktop developer, grab it if you intend to write anything for windows or linux, else, ignore it.
  21. now restart to make sure all settings changes have taken, remember to skip mounting the two bind mounts on startup
  22. sudo mount -a
  23. cd ~/android/environment/system/Titanium\ Developer-1.2.2/
  24. sudo ./Titanium\ Developer

Congratulations, you are now setup to work projects! I recommend leaving the snapshots for a bit, just in case you have issues. And of course, TAKE A NEW SNAPSHOT NOW!!! the last thing you want to do is screw something up at this point and have to go back… Also, since we have our dev env setup on a share from your local system, you can revert to this point at any time and still be able to pick right back up (I have not tested this yet!!).

I want to thank anyone who takes the time to read this, especially if you leave me comments, or tell me where I screwed up! It would be nice if someone comments about the app they create using this setup even!

  1. part one
  2. part two
  3. part three

Part Three – Configuring Ubuntu to use your newly installed Java JRE and SDK
There are a lot of technical steps in this part, and I figured them out mostly through heavy internet searching, piecing together information from other blogs, and trial and error. The main issues were caused by every site expecting you to already have some key components installed before trying to get this working. So when I tried to follow their guides they never worked. That is why we are here now, using a fresh and clean Ubuntu installation.

  1. cd /opt/java && sudo ln -s /opt/java/jdk1.6.0_21 /opt/java/jdk-linked && sudo ln -s /opt/java/jre1.6.0_24 /opt/java/jre-linked – this moves back to the /opt/java directory and creates a link to the jdk folder that we can use to reference to later, that way if we ever install a newer version of java all you have to do is remove the links and create new ones, not have to go through this whole process again! you can test by typing cd jdk-linked && ls – and you will see the contents of /opt/java/jdk1.6.0_21 (don’t forget you can use [tab])
  2. sudo update-alternatives –install “/usr/bin/java” java “/opt/java/jre-linked/bin/java” 10 && sudo update-alternatives –set java /opt/java/jre-linked/bin/java – this updates Ubuntu so it can find your new jre and makes it the default jre to be used by the system (again future proofed because we used the linked location)
    • if you want to, we can setup java for Firefox too
    • mkdir ~/.mozilla/plugins/ && ln -s /opt/java/jre-linked/lib/i386/libnpjp2.so ~/.mozilla/plugins
  3. cd && vi .profile
    • [ctrl+f]
    • [o]
    • EXPORT JAVA_HOME=/opt/java/jdk-linked
    • [enter]
    • EXPORT PATH=$PATH:$JAVA_HOME:$JAVA_HOME/bin
    • [esc]
    • :wq!
  4. now we need to repeat the next set of instruction with the following items placed in [java] (everytime you see [java] put one of the following until you have done these steps for each of the following), I have noted after each one if you need a jre or jdk, or both lines for it, if both, replace the 10 with a 5 on the jdk (this will add both the jre and the jdk alternatives to the list making the jre ones the default). Or, just use this script. (remember to look at the script first to make sure it does what I said, and to set it as executable! cat java-update|more && chmod +x java-update then execute it with sudo ./java-update)
    • java – jre/jdk
    • jar – jdk
    • jarsigner – jdk
    • javac – jdk
    • javadoc – jdk
    • javah – jdk
    • native2ascii – jdk
    • rmic – jdk
    • rmid – jre/jdk
    • rmiregistry – jre/jdk
    • serialver – jdk
    1. sudo update-alternatives –install “/usr/bin/[java]” [java] “/opt/java/jre-linked/bin/[java]” 10
    2. sudo update-alternatives –set [java] /opt/java/jre-linked/bin/[java]
  5. mkdir ~/source-build && cd ~/sourcebuild && sudo apt-get install debhelper gcj-4.4-base gcj-jdk m4 debiandoc-sgml python-docutils cdbs – moving on, we need to install some things before the adding Titanium to the system, this group (plus their dependencies, you don’t want to know what I went through to get this list exactly correct, it took a couple of months the first time I worked on getting this installed) takes up 823MB and took me 16 minutes to download and 2.5 minutes to install. as an fyi, I figured these out by not having them installed the first time around and spent weeks trying to figure each part out, because these files are not what causes the failed instal, linux will pull the dependencies for you when you install something, but there are dependencies of dependencies of dependencies… and somewhere down that line linux fails to grab the final set! So you need to install them in this order, I then spent another week or 2 finding out that those in particular have to be installed before the next set or the next set fails to install!
  6. sudo rm /var/lib/apt/lists/* && sudo apt-get update – this will resolve an issue with the sources of the next step
  7. sudo apt-get install llvm-gcc-4.5 && sudo apt-get build-dep llvm-gcc-4.5 && sudo apt-get -b source python-defaults ruby-defaults && sudo apt-get update && sudo apt-get dselect-upgrade && sudo apt-get autoremove – this set downloads the source files for each of these and builds them specifically for your system and then cleans itself up, this did not prompt me for the additional storage space until it got to the apt-get dselect upgrade step (some 48kb) but the build process took about 20 to 45 seconds on my machine.
  8. sudo apt-get install ispell – I have found a few other things that are necessary for titanium to work
  9. restart your development VM
  10. mount your shared drives and take a new snapshot after the system comes back up, called pre Android SDK, and comments “OS, java jre&jdk, and compilers installed”

maybe you don’t really need all of this, but I don’t want to find out while I am writing my Android app that I missed a step, as then you won’t be able to re-use the snapshots in case of an emergency (also called a mistake!). One other note, if you noticed I made a new directory and used it for the source builds, this is because at least the python source build requires several chown commands to run and if you try to execute them on a VM share mount it will fail and you cannot complete the build. Congratulations! I know this was a tough part to do, and I’ll have to check it over sometime in the future to recreate the entire process step by step and make sure it all works again (never know where there might be a typo!). Next time we meet it will be to install the Android SDK and Titanium. After that we will build a short crappy Android app to test everything and then make an .iso Live CD of the whole VM! The final file was pretty big, I’m not sure if a Live DVD would cover it all! I’ll test this idea and add it to the final post if it works. I will be heading out of town for a couple of days so don’t expect anything before monday!

  1. part one
  2. part two
  3. part four

again, after I finish this series up, I’ll add in resource links

Part Two – installing the Java SDK

Let just get right into it! open up your terminal session and lets continue!

  1. mkdir -p ~/android/environment/system – this will make both the environment and system folders with one command (I love -p!)
  2. sudo mount -a && cd ~/Downloads && ls – make sure everything that should be there is actually there
  3. wget http://javadl.sun.com/webapps/download/AutoDL?Bundleid=47143 – 32-bit Linux java
  4. open the default firefox web browser (should be an icon at the top next to the System pull-down menu), http://java.sun.com/javase/downloads/widget/jdk6.jsp – note, now that oracle owns sun, this link may change!
    1. click the big download button
    2. select linux as your operating system and click continue
    3. then download the file that does NOT say rpm, by clicking on it
    4. choose save – this will automatically put the file in your Downloads folder (which is mapped to your host computer, so if you have to start over, you won’t have to download it again
  5. sudo mkdir /opt/java && sudo cp ./AutoDL?Bundleid=47143 /opt/java/sun-java6-jre.bin && sudo cp ./jdk-6u21-linux-i586.bin /opt/java/ – remember to use [tab] after typing Auto or jdk so you can use this even if the version gets updated
  6. cd /opt/java && sudo ./sun-java6-jre && sudo ./jre-6u21-linux-i586.bin – again remember to use [tab], during the install you’ll have to press [enter] when the jdk is almost done to exit out (it will open a firefox window asking you to register, you can just close it)
  7. sudo apt-get install galternatives
  8. sudo rm /opt/java/*.bin – this will remove almost 200MB from your VM HDD
  9. and restart the VM again
  10. after the VM comes back up mount your shares again and take a second snapshot, we’ll name this one Java jre & jdk installed, in the comments note that you have also added galternatives

We will finish up part two here, the next section is where a little mistake will have you reverting to this last snapshot, so you will be happy we made it (I did not make the second snapshot the first time through and while all the way at the end of part three I had to revert back to the end of part one and redo this section again).

  1. part one
  2. part three
  3. part four
Tagged with:
 
14 visitors online now
3 guests, 10 bots, 1 members
Max visitors today: 23 at 12:30 pm PST
This month: 23 at 02-05-2012 05:37 am PST
This year: 29 at 01-11-2012 02:49 pm PST
All time: 1100 at 08-08-2011 08:11 pm PDT
View in: Mobile | Standard