Deploying Android App Engine in the web (not locally) - android

I created simple Android App which sends a Person object to Android App Engine.
It works great locally: I can see all my records : http://localhost:8888/_ah/admin/datastore?kind=MessageData but now I want to upload it to real google cloud. What I suppose to do?
I have my google cosnole: https://console.developers.google.com/project/apps~boazeriasciana?authuser=0&redirected=true&utm_referrer=https:%2F%2Fwww.google.pl%2F
Where to look for my records? Is there any tutorial for THIS step?
These are my classes:

If you already created your project on app engine, all you need to do is check the configuration on your config xml file and deploy from the console.
If you are using Maven for building your code, check this resource, if you are using Gradle, you can read from step 6 on from this endpoints example.
In any case it all comes down to checking your XML file to check that config is ok and executing the command to deploy your server.
Maven:mvn appengine:update
Gradle:./gradlew todoTxtBackend:appengineUpdate

Related

Unable to find image 'gcr.io/fullstackgcp/gradle:latest' locally on Google Cloud Build

I'm following this https://cloud.google.com/community/tutorials/building-android-apk-with-cloud-build-gradle-docker-image to build Android APKs via Cloud build
Already have image (with digest): gcr.io/cloud-builders/docker
Unable to find image 'gcr.io/fullstackgcp/gradle:latest' locally
/usr/bin/docker: Error response from daemon: pull access denied for gcr.io/fullstackgcp/gradle, repository does not exist or may require 'docker login'.
See '/usr/bin/docker run --help'.
Did anyone experience this as well?
This account had been suspended for billing issues (likely because people were all referring to that image, instead of hosting it themselves); I've already reported that. Meanwhile I've created another one fully working example (without making the same mistake to share the builder image): cloudbuild-android, which is just as good, if not a tad better.
Full disclosure: I've wrote that builder, because of the problem with the image.
I also had this error. Digging deeper I figured that you first need to prepare a Docker image that will build your Android app and upload that image to Google Cloud Registry. To do that I used: Cloud Builders Community:
Checkout their repository
Go to cloud-builders-community/android/
Trigger CloudBuild to build & upload a docker for you (specify the Android SDK version you need):
gcloud builds submit --config=cloudbuild.yaml --substitutions=_ANDROID_VERSION=28
At this point you should be able to use gcr.io/$PROJECT_ID/android:28 instead of gcr.io/fullstackgcp/gradle in the cloudbuild definition provided in the tutorial.
However I decided not to risk and hit the next error, so I used this one (provided by Cloud Builders Community again). They do have a step for caching the gradle build so you would also need a tar docker:
Go to cloud-builders-community/tar/ and run:
gcloud builds submit --config=cloudbuild.yaml
After all of this is done you can build your app by running the following in the app folder:
gcloud builds submit --config=cloudbuild.yaml --substitutions=_ARTIFACT_BUCKET=<your_bucket>,_CACHE_BUCKET=<your_bucket>
The trigger you have already created as part of the tutorial will also work. You just need to add the two variables above: _ARTIFACT_BUCKET and _CACHE_BUCKET

Can I create a Firebase account from code in my app

From a Windows, Android or IOS application, I would like to create a new Firebase account\project when the user installs the app.
Is that possible?
No, it's not possible
In order to create and add a project on firebase you need to upload your package name and
SHA-1(optional but still required for authenticating your client)
After that a JSON file will be generated and you have to put that file in your projects App folder and configure your Gradle files
so you can see now.
You cannot do this process on installing of app

Deploy to App Engine trouble - You must be logged in to perform this action

I am new to Android Studio and have just runned through the tutorial
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints
without much trouble.
However, when I try to deploy my backend to the app server it promts me: "You must be logged in to perofrm this action".
I have no idea of why it teels that. I can easely find me project on the list, and Im logged in to my google acount on various browsers including Chrome.
Have seached the internet, but found no one else with the problem before.
Best Regards Allan
It's possible that your auth has been done a little while ago and the system cannot properly see you authenticated anymore, which would explain such a behavior.
At the bottom of the list of projects, you should see a "add account" button. Click on this and just re-auth. Should clear the bad tokens :).
Steps For Intrgration of App Engine Endpoints Module.
.....................................................
1-:Create an Google Devloper Console Account.Create a new project after completing the project creation they give you a Project id and project no.
2-:Open Android Studio File-->New-->New Project.
3-:After Project creation is completed Right Click On your project select Module-->Google Cloud Module as shown in images folder chouse_module image.
4-:When you Select The Google Cloud Module Then choose "App Engine Java Endpoints Module".as shown in images folder endpoints image.
5-:As soon as the backend module is added to your project and Gradle sync finishes,a new run configuration with your backend's module is created.
6-:Rebuild your project via "Build → Rebuild Project"
7-:Now Check Your Backend started sucesfully naivigate to http://localhost:8080.if your Backend started sucessfully you saw the screen as as shown in images folder devappserver-endpoints image.
Connecting your Backend to your android project.
...........................................................
8-:After Backend Module is created and added strong libraries is automatically genrated for you.
9-:To start sending requests to the added Cloud Endpoints backend API.you Have to created one Async Class in your Project file.you Can Get the Async task class in required Packages folder with name AsynctaskClass.java
10-:To make the actual call, invoke this AsyncTask from one of your Android activities.In this way :: new EndpointsAsyncTask().execute(new Pair(this, "Message"));
11-:Ckeck that you granted an internet permission in menifest or not.
12-:Now check that you have accese to local host as shown in point 7.
13-:Its time to Check in Emulator Change your Run confrigation and run your project If everything goes well, you should see the following toast in your app as shown in images folder emulator-Toast image.
Deploying the backend live to App Engine
......................................................
14-:If your backend is working locally, you can deploy it to Google App Engine.
Stop the backend, if it is running locally, by selecting Run > Stop.
Than navigate to Build > Deploy Module to App Engine.
15-:update your src/main/webapp/WEB-INF/appengine-web.xml file's property and replace myApplicationId with the ID of the project that you just created.as shown in point 1.
16-: you can see the screen as shown in images folder deploy-image image.
17-:In the Deploy to you have to select the project you created on Google Devloper Console.as shown in point 1.
18-:Put the version name and click deploy Button.
19-:Once you have deployed your backend to App Engine, you can connect your Android app to it by modifying AsyncTask class defined in point 9 replace the perticular lines shown in ReplaceCode.java file in required Packages folder.
20-:Now you can communicate with your new App Engine backend!.
For More Info -:
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints.
https://cloud.google.com/tools/android-studio/app_engine/add_module?hl=en.
Ive never used android studio but Im sure its like eclipse sdk puglin.
There is an easy way to deploy ur apps on ur mobile device, but before u get to that point u need to eanable android mobile on debug mode (On settings,developer options).Once u have done that, Im pretty sure there is an option which lets u run ur app on android device making much smother than doing it virtual app.
Hope I helped ya...
Use the gradle commands.
Open the terminal within android studio and run
gradlew appengine:update
Or navigate to the gradle project window and look for the google appengine folder under your backend. And double click the appengineUpdate command.
Adding the backend with android studio should automatically add the appengine plugin for gradle in your backend build.gradle file like this. This plugin is allows you to run the appengine update command.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
I was facing similar issue using Android Studio Ver2.2 in Ubuntu 14.04
I was not able to do sign-in into Android Studio using the SignIn icon from top-left of the Android Studio IDE. When signin icon clicked, a pop-up says that Sign-in using external browser but nothing would pop-up.
Build->Deploy to app Engine->Deploy to tab was also showing the same message as above but no browser would pop up
Even gradlew api:appengineUpdate was not working. (no browser would pop up).
Problem got resolved by changing the File->Setting->Web Browsers (it was listing browsers Chrome, Firefox, Safari in that order). The Default Browser was set to "First listed". I unchecked the chrome and my problem got solved, I was able sign-in and deploy my project.
I spent lot of time finding solution for this, thought it might help others, so posting it.
I had the same issue.
I did not realize it at first but when you get this message, you simply click on the dropdown "Deploy To", and then it invites you to log into your google account.
It is not very intuitive if your project is already selected by default.

mobile backend starter import to android studio

This is my first post in StackOverflow.
I am building an android app using Android Studio. This app requires some cloud backend to sync user data across devices. After some research, I came across the Mobile Backend Starter from google which provides a fully deployed app engine backend and a client android application.
The problem is that every video/tutorial out there is using Eclipse to open this client application. When you try to import it to Android Studio, you get an Assertion:Null error.
Another step I tried is that, I opened it in Eclipse, followed google documentation to set
And then tried to import to Android Studio. This time I got an error that the "The filename, directory name, or volume label syntax is incorrect"
Can someone help me out with this? Is it also possible to use the "Generate Mobile Backend" option in android studio? But wouldnt this mean that we cannot leverage the client libraries provided in Mobile Backend Starter?
Edit (to add more details to the question):
If I use the "Tools > Google Cloud Tools > Generate App Engine Backend" method, will I be able to get all the boiler plate code in the Mobile Backend android client?
Also, I tried today to Generate App Engine Backend and point to my existing Mobile Backend Starter app engine project. But this did not bring in end point connections for mobilebackend api. Am I missing something here?
Yes there is an option in Android Studio also for Generating App Engine Backend.
Tools > Google Cloud Tools > Generate App Engine Backend
Here is a nice tutorial on Android Blog for the same
http://android-developers.blogspot.in/2013/06/adding-backend-to-your-app-in-android.html
But look in to this post before doing this as Google App Engine Back-end still uses maven so you need to install that before using it.
Maven needed when generating Google App Engine backend in Android Studio
This is an old question but for those that come to this now the easiest way to get started is with this unofficial build for android studio. Why couldn't google do this themselves?
https://github.com/thagikura/mobile-backend-starter-android-client-with-AndroidStudio

Android apk file Dynamic Build

I am working on an android project which requires me to build the android's apk file at run time, i am doing so because i need to add a text document. This is like a client server process.
When a user opens a particular ip address, at run time on server side the apk file is built with the text document. The text document contains the users master data which is unique to a single user. At the end, the android app is directly downloaded and installed on mobile phone.
If any one knows the way to do it, please let me know.
You need to do at least several things (I've done similar task in J2ME):
You have to have JDK on server side
ANT tool installed there
Some scripting tool to generate sources (as a last resort your own Java servlet)
So based on user response you should:
using scripting tool generate Java source
generate/collect necessary resources
generate AndroidManifest.xml
run on top of that ANT builder
get APK file and upload it to customer
The easiest way I can see would be to use some software like maven to build your project dynamically. This way, when you receive a request from a user, you start a build with maven and push the output to the request.
There are some nice projects of integration Android - Maven like this.

Categories

Resources