This project is no longer actively developed or maintained.
This is sample code for an Android application that displays some Google Compute Engine(GCE) resources using the GCE API. The sample was created using Android Studio but should also work with Eclipse as well through maven pom.xml importing.
-
Clone the repo locally.
git clone https://github.com/GoogleCloudPlatform/compute-getting-started-android
-
Import the project:
- Open Android Studio and choose "Import Project."
- Select the
ComputeGettingStartedAndroid/ComputeGettingStartedonAndroid/build.gradle
to import and choose the gradle wrapper option. Use default values for the rest of the import screens. - NOTE: If you recieve an import error indicating that "play-services", a
required dependency, could not be found comment out the Google Play Services
dependency line of build.gradle. This is on line 54 of
ComputeGettingStartedAndroid/ComputeGettingStartedonAndroid/build.gradle
. Import the project again. Comment the dependency back in after the following step.
-
Check dependencies (even if the project compiles) using the Android SDK Manager. Ensure the following packages are installed and up-to-date:
- Android Support Repository
- Android Support Library
- Google Play Services
- Google Repository
-
Close and reopen your project. Clean dependencies using the Build menu by choosing "Rebuild Project."
-
Register an developer project with Google. your project and application application with Play Services and allow you to retrieve OAuth2 tokens from Android. Alternatively, it is possible to implement your own OAuth2 flow.
- Use the Cloud Console to create (or reuse) a project for tinkering.
- Use the Cloud console to create a new client ID underneath your project
representing Android app. This is done within the API Access section. The
client ID should be of type "Installed Application" type and subtype Android.
Use
com.google.devrel.samples.compute.android
as the package name. Retrieve your Android debug keystore fingerprint from ADB. On a Mac this command would typically look like this with an empty password:keytool -list -v -keystore ~/.android/debug.keystore
-
Deploy the Android App
- Deploy your app via normal Android deployment procedures.
- You will need to use a version 17 or later "Google APIs" enabled AVD definition if you are using an emulator instead of a physical device. Physical devices need only have Google Play installed to work.