Search This Blog

04 May 2010

Moving existing samples to Maven: GestureBuilder

So I was intrigued by the Gesture API, but did not want to install Eclipse.  What to do?

First, let's create a blank project:
mvn archetype:generate -DarchetypeCatalog=http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml

Archetype: galatea
GroupId: com.android.gesture.builder
ArtifactId: GestureBuilder
Version: 1.0-SNAPSHOT

  • Remove the src/main/android/res/layout/main.xml
  • Remove the src/main/java/com/android/gesture/builder/MyActivity.java

Now we will copy some files over from our sample directory.  For me, that is at C:\java\android-sdk-windows\samples\android-7\GestureBuilder. We will call that directory $SRC and our top-level maven directory $DEST.

  • Replace $DEST/src/AndroidManifest.xml with $SRC/AndroidManifest.xml
  • Copy $SRC/src/* into $DEST/src
  • Copy $SRC/src/* into $DEST/src/main/java
  • Copy $SRC/res/* into $DEST/src/android/res
  • Copy $SRC/res/* into $DEST/src/main/android/res

Make sure your emulator is running then, from your command-line (in $DEST) deploy the app (mvn clean install).  The app will run in the emulator and save the gestures onto the emulated SD card*.


* What? You didn't have an emulated SD card? Oh.  This is how I created my emulator image:
android create avd -n Device1 -t 11 -c 1000M

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. If you are building ApiDemos and you get lots of "error: Error: String types not allowed (at 'layout_width' with value 'match_parent')." make sure that you are targeting the correct version of Android.

    You may remember to change the dependency... or the android:targetSdkVersion... but don't forget the sdk platform in the maven-android-plugin configuration! That took me a good 15 minutes to find!

    ReplyDelete
  3. how to save gesture like image in sdcard

    ReplyDelete
  4. Those gestures are saved to the SD card...

    ReplyDelete