Titanium Community Questions & Answer Archive

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

Build Titanium mobile from source - Android SDK issues

Following the answer here to build from the GitHub source.

I have my class paths all correct as stated here

Upon running Scons I get an error stating that Android SDK is missing, when it is installed and working (OS X 10.6)

scons: Reading SConscript files ...
Exception: No Android SDK directory found:
  File "/Users/jmw/src/titanium_mobile/SConstruct", line 79:
    sdk = AndroidSDK(ARGUMENTS.get("android_sdk", None), 4)
  File "/Users/jmw/src/titanium_mobile/support/android/androidsdk.py", line 42:
    raise Exception('No Android SDK directory found')

My Class paths are:

#Android
export PATH=$HOME/Dev/Android/android-sdk-mac_86/tools:$PATH
export PATH=$HOME/Dev/Android/android-sdk-mac_86/platforms/android-3/tools:$PATH

Where could I be going wrong?

— asked June 18th 2010 by James Whittaker
  • build
  • mobilesdk
  • source
1 Comment
  • Even by specifying the android_sdk into the scons command I now get this error:

    Exception: No "android-4" or "android-1.6" in the Android SDK:
      File "/Users/jmw/src/titanium_mobile/SConstruct", line 79:
        sdk = AndroidSDK(ARGUMENTS.get("android_sdk", None), 4)
      File "/Users/jmw/src/titanium_mobile/support/android/androidsdk.py", line 46:
        self.find_platform_dir()
      File "/Users/jmw/src/titanium_mobile/support/android/androidsdk.py", line 88:
        raise Exception("No \"%s\" or \"%s\" in the Android SDK" % ('android-%s' % self.api_level, android_api_levels[self.api_level]))
    

    Can someone PLEASE give clear instructions of how to build from source.

    — commented June 19th 2010 by James Whittaker

5 Answers

  • I got this working by making a few changes.

    Take a look at the diff here: http://github.com/thisduck/titanium_mobile/commit/89e5a00bffa05ce94879e6f0a14dc6e7ac10f222

    Make those changes, or clone http://github.com/thisduck/titanium_mobile and then run

    scons android_sdk=$ANDROID_HOME
    

    That should build from the sources.

    — answered June 22nd 2010 by Adnan Ali
    permalink
    0 Comments
  • Thanks Joel that was spot on!

    So make sure you have a symlink from

    /opt/android-sdk/
    

    to your android-sdk directory.

    All my symlinks were correct I just needed to change the line (as Joel stated above):

    <property name="android.platform" value="${android.sdk}/platforms/android-1.6"/>
    

    to

    <property name="android.platform" value="${android.sdk}/platforms/android-4"/>
    

    Build successful :-)

    — answered July 6th 2010 by James Whittaker
    permalink
    0 Comments
  • After re-adding a sym link to my android directory as stated in the docs, I now get so far along with the build.

    However build fails with

    package com.google.android.maps does not exist
    

    I have checked and installed the Google API's Android API 8, revision 1 as detailed in the Google Android docs as the Maps SDK is not installed by default.

    Build still fails. Giving up now…

    — answered June 19th 2010 by James Whittaker
    permalink
    1 Comment
    • I had to create symlinks in my platform and addons directory that correspond to the 1.6 android stuff.
      Check out android/build.xml in the titanium mobile repo.
      Relevant XML is below.

      <property name="android.platform" value="${android.sdk}/platforms/android-1.6"/>
      <property name="google.apis" value="${android.sdk}/add-ons/google_apis-4_r02"/>
      

      Basically, if you install the android sdk today, those directories will never exist, and titanium won't compile.

      — commented June 30th 2010 by Joel Meador
  • Still not working I have forked the main repository dones the changes as specified by Adnan (thanks for the info) but I'm still getting the same error messages. "No "android-4" or "android-1.6" in the Android SDK:"

    I also don't get anything when I type aapt v in to the terminal. Somethings a miss but I can;'t work out what it is?

    Really need to build from source. Titanium folks can you add a how to build section into the README file please?

    — answered June 30th 2010 by James Whittaker
    permalink
    1 Comment
    • If you're not seeing any output from aapt -v then your path is wrong. The builder script uses these commands to work out where things are for when it compiles the source.

      Titanium has a minimum requirement of Android 1.6.
      Assuming you have locate installed, the locate database is up to date (sudo updatedb) and you have all of them downloaded, you should be able to use locate to list their locations - ala:

      locate android.jar | grep platforms
      

      You should see output like:

      /usr/local/android-sdk-linux/platforms/android-1.5/android.jar
      /usr/local/android-sdk-linux/platforms/android-1.6/android.jar
      /usr/local/android-sdk-linux/platforms/android-2.0.1/android.jar
      /usr/local/android-sdk-linux/platforms/android-2.1/android.jar
      /usr/local/android-sdk-linux/platforms/android-8/android.jar
      

      Likewise - you can find the Google addons (used for maps) using:

      locate maps.jar | grep add-ons
      

      With the above info - you can pass the lib paths directly to scons with:

      scons android_platform=/usr/local/android-sdk-linux/platforms/android-1.6 android_sdk=/usr/local/android-sdk-linux google_apis=/usr/local/android-sdk-linux/add-ons/google_apis-4_r02/
      

      Assuming that works properly then you should fix your path - so that the aapt, adb & android commands work. It'll make everything else a little easier.

      If it doesn't work - then if you can paste the complete output from when you run scons - it should be debug what the problem is.

      — commented June 30th 2010 by David Ashwood
  • Hello,

    I have just published a post on my blog concerning building 1.8.0.1 from source on Ubuntu 10.04

    http://www.wlaurance.com/2011/12/06/building-titanium-mobile-sdk-1-8-0-1-from-source

    — answered December 6th 2011 by Will Laurance
    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.