Understanding the project organization

  • Source Code (SVN)
    • XQuery Android Library (part of the MXQuery mainline)
      • https://mxquery.svn.sourceforge.net/svnroot/mxquery/trunk/MXQuery/
      • Android specific files are in the /android directory
      • The ant build file (build.xml) configures the project to remove the unsupported classes, overwrite the files with corresponding files in the /android directory, and repackage some classes that are in reserved namespaces (e.g. XQJ).
      • To build the android library from ant, use the target jar-android  (FYI – building directly with ant from the command line seems to work better than from within Eclipse) and specify the root directory of your Android SDK installation as sdk.dir property, e.g. ant -Dsdk.dir=D:\Java\android-sdk-windows-1.5_r3 jar-android.
    • Android Demo App
  • Testing
    • Android branch uses the same test suite as the other MXQuery versions (MXQuery_Testing)
    • Note:  Testing is currently only set up for the library project.  There are no tests for the demo application.
    • Since we are not testing any Android UI updates, we can use normal JUnit tests instead of the Android JUnit testing framework
    • Also, we can build the tests against the normal Java SDK instead of the Android SDK (we tested with both and got exactly the same results).
  • Continuous Integration
  • Documentation

How to set up your dev environment

  1. Install Eclipse (if you don’t already have it).  Using Eclipse is highly recommended because of the Android development tools integration.
  2. Install Android SDK
  3. Install ADT plugin for Eclipse
  4. Install ADT platforms and components from the Android SDK and AVD Manager.  To launch from within Eclipse, select Window > Android SDK and AVD Manager
    1. SDK Platform Android 2.2, API 8
    2. Google Android APIs (optional, but required to use the demo app because of the map mashup)
  5. Create an Android Virtual Device (AVD)  (optional if you have a physical Android device for testing via USB)
    1. From Eclipse > Window > Android SDK and AVD Manager > Virtual Devices > New
      • Target = Google APIs, API Level 8
    2. Checkout MXQuery source code from SVN
    3. Add MXQuery project to Eclipse
      1. File > Import > Existing Projects into Workspace
    4. Configure MXQuery project in Eclipse to build Android JARs (or just use ant from the command line as explained above)
      1. Project > Properties > Builders > New > Ant Builder
        • Main
          • Buildfile = ${workspace_loc:/MXQuery/build.xml}
        • Targets
          • After a “Clean” = none
          • All others = jar-android
      2. Checkout MXQuery Android Demo App source code from SVN
      3. Add MXQuery Android Demo App to Eclipse
        1. File > Import > Existing Projects into Workspace
      4. Configure MXQuery Android Demo App in Eclipse
        1. Add the MXQuery JAR to the build path.  2 options:
          • Use the JAR from the other Eclipse project (recommended for development)
            • Configure Build Path > Add JARs > MXQuery > dist > mxquery-android.jar
          • Download the JAR from the CI server to the lib directory of your project
            • Configure Build Path > Add JARs > MXQuery_Android_App > lib > mxquery-android.jar
        2. Attach the source JAR
          • Configure Build Path > mxquery-android.jar (click on arrow) > Source attachment (double click) > mxquery-android-source.jar
        3. Configure Google API key
          1. Generate Google Maps API key for debugging
          2. Add your API key to res/layout/map.xml