The below steps will help you build and run the project.
- Download and install the Android SDK. Make sure to install the Google APIs for your API level (e.g., 17), the Android SDK Build-tools version for your
buildToolsVersionversion, and the Android Support Repository and Google Repository. - Set the "ANDROID_HOME" environmental variable to your Android SDK location.
- Set the "JAVA_HOME" environmental variables to point to your JDK folder (e.g., "C:\Program Files\Java\jdk1.6.0_27")
- Download and install the latest version of Android Studio.
- In Android Studio, choose "Import Project" at the welcome screen.
- Browse to the location of the project, and double-click on the project directory.
- If prompted with options, check "Use auto-import", and select "Use default gradle wrapper (recommended)". Click "Ok".
- The default build flavor will be the
googleflavor, which is the version of GPSTest on Google Play that uses Google Play Services for maps. If you want to build the version on Fdroid that uses OSMDroid for maps, use the "Build Variants" toolbar item to select theosmdroidflavor. - Click the green play button (or 'Shift->F10') to run the project!
- To build and push the app to the device, run
gradlew installGoogleDebugfrom the command line at the root of the project for the version of GPSTest on Google Play. If you want to build the Fdroid version with OSM Droid, then usegradlew installOsmdroidDebug. - To start the app, run
adb shell am start -n com.android.gpstest/.GpsTestActivityfor the Google Play version, oradb shell am start -n com.android.gpstest.fdroid/.GpsTestActivityfor the Fdroid version (alternately, you can manually start the app)
To build a release build, you first need to create a gradle.properties file that points to a secure.properties file, and a secure.properties file that points to your keystore and alias.
The gradle.properties file is located in the \GPSTest directory and has the contents:
secure.properties=<full_path_to_secure_properties_file>
The "secure.properties" file (in the location specified in gradle.properties) has the contents:
key.store=<full_path_to_keystore_file>
key.alias=<key_alias_name>
key.storepassword=yourKeystorePassword
key.keypassword=yourKeyPassword
Note that the paths in these files always use the Unix path separator /, even on Windows. If you use the Windows path separator \ you will get the error No value has been specified for property 'signingConfig.keyAlias'.
To build the release build, run:
gradlew assembleRelease
When importing to Android Studio, I get an error "You are using an old, unsupported version of Gradle..."
If you're using Android Studio v0.4.2 or lower, when importing, please be sure to select the "settings.gradle" file in the root, NOT the project directory. You will get the above error if you select the project directory / name of the project.
Open Android SDK Manager, and under the "Extras" category make sure you've installed both the "Android Support Repository" (in addition to the "Android Support library") as well as the "Google Repository". Also, make sure you have the Google API installed for the API level that you're working with in the "/build.gradle" file, including the "Android SDK Build-tools" version (at the top of the "Tools" category in the Android SDK Manager) that matches the compileSdkVersion and buildToolsVersion numbers in /GPSTest/build.gradle.