Reference links:
https://cloud.google.com/sdk/docs/quickstarts
https://cloud.google.com/endpoints/docs/frameworks/java/migrating-android#cloudsdk
- Download the Cloud SDK depending on your operating system from this link - https://cloud.google.com/sdk/docs/quickstarts
- Save google-cloud-sdk folder downloaded from the above link to a directory of your choice.
- Open Terminal and navigate to the directory that contains google-cloud-sdk
- At command prompt, run the folllowing: $ gcloud init.
This will launch a web browser, and prompt to login to Google console.
Note: If you do not want to launch a web browser, use this command - $ gcloud init --console-only.
For more info on how to progress with this option, check out this page - https://cloud.google.com/sdk/docs/quickstart-macos
- If you have used $ gcloud init command, then it will display the following:
To continue, you must log in. Would you like to log in (Y/n)?
Enter Y to continue.
- Log in to Google account using the browser; it will prompt to grant permissions to access Google Cloud Platform resources.
Click Allow.
- Once logged in, return to the Terminal. It will now show a list of projects to select from or create a new project.
Pick cloud project to use:
[1] linear-elf-192315
[2] pacific-aurora-192315
[3] squawker-73bc4
[4] Create a new project
Please enter numeric choice or text value (must exactly match list item):
Enter 4 here (the number can be different; basically choose option to create a new project).
- It will now prompt to enter a Project ID. Choose an ID that is
- of length 6 to 30
- contains lowercase letters, digits and hyphens only
- starts with a lowercase letter.
Example – jokeapp-udacity-project4. (it does not have to be same name as app or package)
- It will now set up the project using the ID provided. The Google console opened in the browser should show the new project.
- Return to Terminal, and run the following command - $ gcloud auth application-default login. This tells Cloud SDK to use application default credentials. Once this command is run, it will show the Json file name that has the credentials saved.
- Now it's time to install the app-engine-java
Return to Terminal and run this command - $ gcloud components install app-engine-java.
It may prompt once to continue, enter Y to allow it continue with the installation.
- If the installation is successful, open the project that will use GCE server Android Studio, and expand the Gradle tab.
From there, select :backend > app engine standard environment > appengineStart.
This should start the Google App Engine.
Open this link in your browser - http://localhost:8080/
If all has gone OK, so far then this link should have a display like this:
- To stop the engine, select :backend > app engine standard environment > appengineStop.