aaroncrutchfield / BuildItBigger

0 stars 0 forks source link

Step 3: Setup GCE #5

Closed aaroncrutchfield closed 5 years ago

aaroncrutchfield commented 5 years ago

This next task will be pretty tricky. Instead of pulling jokes directly from our Java library, we'll set up a Google Cloud Endpoints development server, and pull our jokes from there. The starter code already includes the GCE module in the folder called backend.

Before going ahead you will need to be able to run a local instance of the GCE server. In order to do that you will have to install the Cloud SDK:

https://cloud.google.com/sdk/docs/

Once installed, you will need to follow the instructions in the Setup Cloud SDK section at:

https://cloud.google.com/endpoints/docs/frameworks/java/migrating-android

Note: You do not need to follow the rest of steps in the migration guide, only the Setup Cloud SDK.

Start or stop your local server by using the gradle tasks as shown in the following screenshot:

GCE-server-gradle-tasks.png

Once your local GCE server is started you should see the following at localhost:8080

devappserver-endpoints.png

Now you are ready to continue!

Introduce a project dependency between your Java library and your GCE module, and modify the GCE starter code to pull jokes from your Java library. Create an AsyncTask to retrieve jokes using the template included int these instructions. Make the button kick off a task to retrieve a joke, then launch the activity from your Android Library to display it.

┆Attachments: GCE-server-gradle-tasks.png | devappserver-endpoints.png | image.png | image.png

aaroncrutchfield commented 5 years ago

Exception thrown when retrieving joke from EndPointsAsyncTask

image.png

aaroncrutchfield commented 5 years ago

image.png

aaroncrutchfield commented 5 years ago
aaroncrutchfield commented 5 years ago

Solution: Migrate Google Cloud backend module from Java 7 to Java 8 Migrating from Java 7 to Java 8 Run appengineDeploy from gradle tasks Run appengineStart from gradle tasks