KUbuntu 10.04 32-bit and Appcelerator Titanium Desktop [working]

So, I’ve started with a clean OS install in a virtual box VM (see screen shot) and here is where I’ve gone from there (currently not working, waiting on some advice from the Titanium Developers forums)…

Titanium Kubuntu 10.04 Virtual Machine Settings

Titanium Kubuntu 10.04 Virtual Machine Settings

Before we get started I want to make sure you know that there are a lot of steps below and that not all of them are necessary, again this is just how I did it.

*********update 5-17-2010**********

(on doing this again on a new from scratch system I have learned that in the Java section, steps 10-31 may not be necessary at all. while this is a good thing to have setup on your system for future upgrades, it is not necessary UNLESS you have the open source java installed prior to installing java (or anytime after installing java. this is actually out of order in these steps, you would have to do steps 1-7 in the following section (installing gcj-4.4-base) BEFORE doing the Java section, else steps 10-31 will not work.)

First let’s finish setting up the Ubuntu installation and get out guest additions installed. (although I use KDE, all of this should work from gnome, or ice, or xfce, or whatever GUI window manager you have chosen.

  1. sudo apt-get update
  2. sudo apt-get install dpkg dpkg-devel
  3. sudo apt-get dselect-upgrade
  4. sudo apt-get install yakuake
  5. reboot
  6. sudo apt-get autoremove
  7. select “devices” from the VM window
  8. select “install Guest Additions”
  9. when the “devices recently plugged in” window appears, click on the VBox guest additions, and select browse with Dolphin. this will mount the CD in /media for you
  10. cd /media/VB[press the tab here for auto-completion, as the name changes for every version of VirtualBox]
  11. sudo ./VBoxLinuxAdditions-x86.run
  12. wait for it to finish, then reboot your system (simplest way, not only method)

Now you should be able to resize your screen by just resizing the VBox window, and your mouse should move between host and guest without exclusivity, you also should get better performance if your host is outdated or low end.

Let’s install java SE JDK!

  1. cd ~/Downloads
  2. mkdir android
  3. mkdir android/environment
  4. mkdir android/environment/system
  5. http://java.sun.com/javase/downloads/widget/jdk6.jsp (this is where you need to go to get the current Java SE JDK, I tried to find a direct url useable by wget, but they have it scripted so you need to use the web browser, save this file in /opt/java)
  6. cd /opt/java
  7. sudo chmod +x jdk*
  8. sudo ./jdk-6u20-linux-i586.bin (may need to change the name depending on the the version you downloaded, this will install/extract java into the /opt/java directory)
  9. sudo rm jdk-6u20-linux-i586.bin (since this is a vm, it is a good idea to clean up after yourself! the final virtual hdd is gonna be pretty big anyway)
  10. sudo ln -s /opt/java/jdk1.5.0_09 /usr/lib/jvm/java-sun
  11. sudo vi /etc/jvm (this file did not exist for me, do not know why you need to do this or if you can skip this step)
  12. O
  13. “/usr/lib/jvm/java-sun” (make sure to include the quotes, again I do not know why, but the Ubuntu Forum post I found said to do it this way)
  14. sudo cp /usr/lib/jvm/.java-gcj-jinfo /usr/lib/jvm/.java-sun-jinfo (this file does not exist on my system, if you have it do steps 14 – 17, if not skip them, as he did not give the details of the expected file contents)
  15. sudo vi /usr/lib/jvm/.java-sun.jinfo
  16. [esc] :%s/java-gcj/java-sun/g (make sure to get the colon as the first character if you are copy and pasting!! this line replaces all the gcj’s with sun, gcj is the GNU open source version of java, what we are doing here is replacing the references to it with references to the newly installed sun java so your system will use sun java instead of the GNU java)
  17. [esc] :wq!
  18. sudo apt-get install galternatives
  19. sudo ln -s /usr/lib/jvm/java-sun/ /etc/alternatives/java-sun
  20. galternatives (this will run the GUI version of alternatives so you can make edits on the files without using vi)
  21. select each of the following one by one and repeat steps 22 – 24 for each one. jar, jarsigner, java, javac, javadoc, javah, native2ascii, rmic, rmid, rmiregistry, serialver
  22. click ‘add’
  23. set path to /etc/alternatives/java-sun/bin/[name of what you are changing, ie jar, java, javah, javap…]
  24. set the priority to the “gcj priority”+1 (note it will not allow you to input numbers greater than 1000 in the GUI, those must be done manually, so just set them to 1000 at this time. it is recommended not to set them to manual, so see step 34 after completing all of these additions for how to make these the defaults.)
  25. sudo update-alternatives –force –install /etc/alternatives/javap javap /usr/lib/jvm/java-sun/bin/javap 1066 (javap did not exist for me so I had to enter this at the command line, it returned multiple errors; however when I reran galternatives, the new setting was there.)
  26. cd /var/lib/dpkg/alternatives
  27. sudo vi java (repeat this process, steps 27 – 29, for all the changes above that you were not able to set the priority over 1000 on)
  28. [esc] :%s/1044/944/ (replace the “1044” with the number that your system has, this may be different for each file. for simplicity, set the “944” to the number your system has – 100)
  29. [esc] :wq! (note, this is not necessarily the fastest nor most efficient way of using vi, nor is it the way I usually do it; however I use this method when I write this information out, because it will work regardless of the contents in your file that are/were not in mine AND because without actually seeing the file I cannot tell you “go to line # 5′ or ‘change the third word of the eighth line to “blah”‘. this method should prevent you from inadvertently changing something you should not, I hope…)
  30. java -version (this should display the version you just downloaded and installed, if not… go over the steps again and make sure you followed them all, else… well back to searching the inet for a solution, for you!
  31. javac -version (just in case check this one too!)

Right now that that is done, let’s move on to installing the dependencies for your development environment (again, may not be the only method, nor even the recommended one, but this is what I have done!)

  1. cd ~/Downloads/android/environment/system (this will keep your home folder from filling with source code and build files)
  2. sudo apt-get install debhelper gcj-4.4-base gcj-jdk m4 debiandoc-sgml python-docutils cdbs (these are the dependencies for step 3 and need to be installed first)
  3. sudo apt-get -b source gcc-defaults gcc++ python-defaults ruby-defaults
  4. sudo apt-get update
  5. sudo apt-get dselect-upgrade (check for any updates to the files you have just installed, always a good thing!)
  6. sudo apt-get autoremove (this removed 85.2MB for me)
  7. at this point I did a complete shutdown and created a snapshot in VirtualBox. current Virtual HDD file was 4.72GB before I took the snapshot. (in case I messed something up in the next part, as we have accomplished a good bit of work at this stage)

Now that all of your prerequisites have been installed, let’s install our development environment! (finally)

  1. go to http://developer.android.com/sdk/adding-components.html and download the android SDK to /opt
  2. using dolphin (or your favorite GUI folder browser) find this file and right click on it, select extract here
  3. cd android-sdk-linux_x86/tools
  4. sudo ./android
  5. goto settings first and check the box for “force https://”
  6. select available packages click the down arrow to the left of the web address shown.
  7. check the boxes for: SDK 1.6 API 4 R2 / SDK 2.1 API 7 R1 / Google API 1.6 / Google API 2.1 (this will let you code for Android 1.6 (more of these currently than any other OS version) and 2.1 devices (the newest available) and the google API’s will let you access the preinstalled google apps that come with android and their resources (google maps and voice command and such) I also recommend the samples and documentation files if you are new to coding for Android.
  8. click “install selected”
  9. click “accept all”
  10. click “install” (at this point it will begin installing, you can wait, or continue on to my next step while it does this, personally I let it run, and went to get something to eat!! make sure you check the details before closing, my 1.6 environment did not install with the error: finished with wrong size, expected 63422901 bytes received 4828132 bytes, this also caused the google APIs for 1.6 to fail and I had to re-attempt to install 1.6, everything worked the second time)
  11. cd ~
  12. vi .bashrc
  13. press the following “jjjO” (this will move you down 3 lines, insert a new line and allow you to start editing, then just copy and past the following 2 lines)
  14. export JAVA_HOME=/usr/lib/jvm/java-sun
  15. export PATH=$PATH:$JAVA_HOME:/opt/android-sdk/
  16. [esc] “wq!
  17. cd ~/Downloads/android/environment/system
  18. sudo wget http://www.appcelerator.com/download-linux32 (this should get you the “Titanium Developer.tgz” file)
  19. use dolphin again to right click and “extract here”
  20. now you should have a “Titanium Developer-1.2.1” directory
  21. cd /opt/titanium/runtime/linux/1.0.0 (need to fix some incompatibilities that I found on the Titanium Developers forum)
  22. sudo mkdir backup
  23. sudo mv libgobject-2.0.* backup/
  24. sudo mv libglib-2.0.* backup/
  25. sudo mv libgio-2.0.* backup/
  26. sudo mv libgthread-2.0.* backup/
  27. cd ~/Downloads/android/environment/system/Titanium\ Developer-1.2.1/
  28. ./Titanium\ Developer (I have tried both with and without sudo, but it throws an error instead of running. I have posted a question on the Titanium Developers forum and linked it to here, so hopefully someone can help me out.)

Now that 32-bit is working, I’ll give the x64 version another shot this weekend. Hope I did not upset too many people over at the forums with my first post! but neither google nor bing came up with that forum post while I was searching…

About

One thought on “KUbuntu 10.04 32-bit and Appcelerator Titanium Desktop [working]