-
Notifications
You must be signed in to change notification settings - Fork 90
Paco Dev On Mac
Steps on how to start Paco development on Mac
- JDK
- Git
- Android SDK
In order to pull the Paco sources from code.google.com you will need a source code management system called Git.
Git might already be available if you have Xcode installed from the App Store, but can also be downloaded from the Git website if you prefer a more recent version.
To verify if Git is available on your system, open Terminal and type:
git --version
This should return the version number of your current Git install.
The Android SDK is downloadable from here: https://developer.android.com/sdk
By default the Android SDK will only include the latest Android version, but in order to build Paco we'll also need the Android 2.2 API 8 Packages. Moreover, since Paco requires a Google Account the Google APIs targets are necessary as well. We'll do all this by launching the Android SDK Manager:
android sdk
Make sure these (extra) Packages are installed, by selecting them in the Android SDK Manager and clicking 'Install 3 packages':
- Android 4.2.2 (API 17)/Google APIs
- Android 2.2 (API 8)/SDK Platform
- Android 2.2 (API 8)/Google APIs
In order to test the Android Paco App we'll need to configure a Emulator (or use a external device).
Open the installation of Eclipse downloaded as part of the ADT Bundle (at this point, you may choose a temporary workspace or follow the steps under Eclipse - Create a Workspace). Go to the 'Window' menu and select 'Android Virtual Device Manager', and follow these steps (while leaving other settings alone):
- Click 'New'
- Name: paco-emulator-2.2
- Device: Nexus One (3.7", 480 x 800: hdpi)
- Target: Google APIs (Google Inc.) - API Level 8
- SD Card: Size: 20 MiB
- Emulation Options: check 'Snapshot'
- Click 'OK'
- Exit the Device Manager.
Now that we have a complete environment with an emulator setup it's time to pull the sources from code.google.com.
git clone https://code.google.com/p/paco/ paco-git
By default the 'master' branch is pulled, though the latest development happens in the 'develop' branch
cd paco-git
git checkout --track origin/develop
The Android SDK ADT Bundle we downloaded earlier comes with Eclipse 3.8/4.2(Juno) pre-installed, so let's start with configuring a workspace for our projects:
- From the root of our Project (/Users/jdoe/Paco) let's launch Eclipse open adt-bundle-mac-x86_64-20130219/eclipse/Eclipse.app
- Set the workspace to /Users/jdoe/Paco/workspace
Since the Paco AppEngine Server requires the Google AppEngine Tool and Eclipse plugin we need to install:
- Google App Engine Tools for Android (requires ADT)/Google App Engine Tools for Android
- Google Plugin for Eclipse (required)/Google Plugin for Eclipse 4.2
By following these steps (no need to add other packages of the AppEngine SDK, they're in the Paco sources):
After the reboot of Eclipse, we need to configure Eclipse to point at the local installations of GWT and AppEngine:
- In the Menu click 'ADT/Preferences'
- In the 'Preferences' dialog select 'Google/App Engine'
- Click 'Add'
- Click 'Browse' and select '/Users/jdoe/Paco/paco-git/tools/appengine-java-sdk-1.7.5'
- Click 'OK'
- In the 'Preferences' dialog select 'Google/Web Toolkit'
- Click 'Add'
- Click 'Browse' and select '/Users/jdoe/Paco/paco-git/tools/gwt-2.5.0'
- Click 'OK'
- Click 'OK' again to close the 'Preferences' dialog
Before compiling the individual pieces below (Android App, App Engine Server), we need to do a full Ant build from the root to construct the Shared libraries.
In order to do so we need to create a local.properties file in the Android directories that helps the build process find the Android SDK. We do this by running:
android update project -p .
(Always make sure to have the SDK tools in the PATH. See above.)
In each of the following directories
- paco-git/Paco
- paco-git/PacoAndroidLib
- paco-git/PacoTest
With everything setup let's run from the root (paco-git):
ant build
Before running the steps below, make sure you've completed a first build (see 'Building the first time') since the Paco Android App relies on those Shared libraries.
Open Terminal in the paco-git root and use the following commands to create a debug release (not one you're plan on shipping) of the App
cd Paco
ant debug
Before we can install the App we want to launch the emulator, such that the build process can deploy. We do this by launching the emulator we've created in the section 'Android SDK - Configuring Emulator' as a background process:
emulator -avd paco-emulator-2.2 &
Installing the App happens still from the pack-git/Paco directory by typing:
ant debug install
In the emulator touch the Launcher icon at the bottom of the screen to view all installed applications. There should now be an icon with a dog for the PACO App.
For further build and deployment options on the command-line type in the Paco directory:
ant -p
Make sure to first complete the steps to configure Eclipse.
Then we import the Shared libraries project:
- In the Menu click 'File/Import'
- In the 'Import' dialog click 'General/Existing Projects into Workspace'
- Set the Root directory to the Shared in the paco-git directory (/Users/tpennings/Project/Paco/paco-git/Shared)
- Click 'Finish'
And finally, load the Paco Android App projects:
- In the Menu click 'File/Import'
- In the 'Import' dialog click 'Android/Existing Android Code into Workspace'
- Set the Root directory to the paco-git directory (/Users/tpennings/Project/Paco/paco-git)
- Select all three of the Projects to import (Paco, PacoAndroidLib and PacoTest)
- Click 'Finish'
With the App in Eclipse, and the ability to run the Emulator you can now debug, deploy and run the Android App.
If the emulator continually crashes unexpectedly during runs and LogCat indicates that 'com.google.paco.shared.Outcome' could not be found:
- Right click on the 'Paco' folder in the Package Explorer and choose 'Build Path' and then 'Configure Build Path.'
- Select 'Java Build Path' in the left column of the popup window, and then choose the 'Order and Export' tab at the top.
- Make sure that that 'Shared' folder is selected. This will ensure that libraries and files from the Shared folder are imported into the Paco build. While here, make sure that the four visible libraries and 'Android Dependencies' are also selected.
Before running the steps below, make sure you've completed a first build (see 'Building the first time') since the Paco AppEngine Server relies on those Shared libraries.
Open Terminal in the paco-git root and use the following commands to create a debug release (also not one you're plan on shipping) of the Paco AppEngine Server
cd Paco-Server
ant -f antbuild.xml
With the Paco AppEngine Server built we can now run a local server on port 8080:
ant -f antbuild.xml runserver
For further build and deployment options on the command-line type in the Paco-Server directory:
ant -f antbuild.xml -p
To deploy the Paco AppEngine Server to appengine.google.com, you will of course need to edit the war/WEB-INF/appengine-web.xml file to point it at your AppEngine application identifier by editing the <application> tag. Then run
ant -f antbuild.xml update
Make sure to first complete the steps to configure Eclipse.
Let's import our Paco AppEngine Server project:
- In the Menu click 'File/Import'
- In the 'Import' dialog click 'General/Existing Projects into Workspace'
- Set the Root directory to the Paco-Server in the paco-git directory (/Users/tpennings/Project/Paco/paco-git/Paco-Server)
- Click 'Finish'
We also need to clean up the library links:
- In the dialog 'Properties for Paco-Server' select the 'Libraries' tab
- Click 'Add Library'
- Choose 'Google App Engine' and select 'Use Default SDK'
- Remove the 'GWT SDK
[missing](unbound)' by selecting it and clicking 'Remove' - Click 'Add Library'
- Choose 'Google Web Toolkit' and select 'Use Default SDK'
- Finally remove all 27 build paths with a red cross next to them
If after running the server you are unable to log in (the server kicks you out):
- Go to DBWhitelist.java in Paco-Server.
- Go to the isAdmin method and change the return statement to:
return email.equals("<your email address>");filling in the email address you use to log into the Paco server. - Please DO NOT commit this local hack to the git repository.