#AndroidStudio makes it easy to add a cloud backend right from your IDE.  With a single command you can generate a complete project that includes an App Engine backend and an endpoints module to access the backend from your app. The project also includes built-in support for Google Cloud Messaging (GCM),  to make it easy to sync data across multiple devices. 

With Android Studio you can develop and test your client and server code together in a single environment, and you can generate new endpoints to add your own custom cloud services. When you are ready, you can build and run your server side code locally and even deploy it to production, direct from Android Studio. 

The post below shows you how to get started.

Link: http://android-developers.blogspot.com/2013/06/adding-backend-to-your-app-in-android.html

#AndroidDev
229
127
Philipp Richter's profile photoJoel Schnall's profile photoDiego Bao's profile photoErik Mejia's profile photo
62 comments
 
I saw the video of this from IO. It want to try but I've been using eclipse for so long it's hard to take the plunge. Anyone have any positive experiences with this? The ability to set up C2DM with a few clicks sounds like a winner to me.
Ugo Ano
 
I have been the same +Jamie Arellano  - it's the thought of setting up all over again.  The I/O video was soo enticing though, I might still give it a shot.
Ugo Ano
 
Sorry for my noobish reply, but are endpoints another way of saying connecting to your gae project? I have that without endpoints currently
Ugo Ano
 
Man, I could've really done with that last year! I'll take a look :-) Just put my Chromebook in dev mode so I'm feeling a little adventurous. Lol,  Thanks +Brad Abrams 
 
Every time I try and use Android Studio, I end up failing to get anywhere at all.

All my projects exported from Eclipse fail to import correctly into the Android Studio/Gradle build system.

Specifically anything with a library, the library references in the gradle stuff never work, and I have no idea how to fix them.

Hoped by now they had sorted this.
 
+Mark Gillespie  My experience from taking projects from different IDE's is you need to build everything from scratch. Start a new project and then paste in all the files. Eclipse throws in a bunch of extra files that may conflict with any other IDE. When dealing with libraries a straight import has even less chance to build. In my opinion.
 
Same here +Mark Gillespie so you are not alone. I have done everything to avoid starting from scratch. May give +Jamie Arellano approach a whirl. I'm not making any progress anyway.
 
+Android Developers are you headed to a 1.0 release?  If not, will there be some other indication as to when it is ready for more conservative devs to give it a try?
 
+Mark Gillespie +David Johnson The issue is the export from Eclipse is not reliable in creating Gradle files. We are fixing this.

Right now, Studio is clearly not something ready for all developers. As we make progress, we'll probably release some pre-1.0 milestone builds that are meant for wider audience. Stay tuned.
 
I really like the way how the Android Development Team get involved in discussions with us through the posts, keep the good work guys. 
 
Thanks +Xavier Ducrohet I understand progress takes time. Personally I just find it frustrating when I can't figure out a way to "make it work"
I'm really excited about android studio and have continued to spend countless night time hours tinkering in it and getting accustom to it. I can see already this is the future of android development and can't wait to see how far it takes us.

Good luck with the Gradle files on import create. But if you happen to know of a standard method in which manually "patch" or "repair", that would be great to share.

So far endless results in Google search turn up nothing but tons of stacktrace post of people having similar problems all of which are other ide related and in no way help with android studio. (Being so new and all I suppose)

Cheers
 
Being new, I thought Android studio was much easier to use them eclipse. Automates lots of tedious code wrlriting, lots of cool features. And it seems like the software is updated weekly, wow great job. 
 
Manually brought some code in last night and so far loving it. It's not a massive resource hog like eclipse is. Still a fair about of bugs to sort out, but it's usable for me.

The project importing stuff is still broken thou, so people need to do it the long way.
 
I'm following the steps in this blog post but when I run the application and press Register button it shows an error saying "A Google Cloud Message registration error occurred (errorid: INVALID_SENDER). Do you have your project number (1) set correctly, and do you have Google Cloud Messaging enabled for the project?"  What could I be missing?
 
Hey Victor...   Two things to check.
Look for GCMIntentService.PROJECT_NUMBER and make sure that is set.   

If so, go to your project on http://cloud.google.com/console, under APIs and make sure Google Cloud Messaging for Android is enabled. 
 
I am currently running into the following error after having followed the steps: Unresolved Plugin 'com.google.appengine:appengine-maven-plugin:1.8.0'. 
My other two plugins have downloaded just fine, along with all my dependencies. I have not used IntelliJ before, so I might be making a really silly mistake. Does anyone have any ideas? Thanks!
 
Doesn't generate -endpoints module for me. Only -AppEngine module is generated. Build # AI-130.725679

Edit: works like a charm. Had an error in the app's manifest file. For some reason, that kept it from generating -endpoints.
YH Yang
 
After reading the blog, It seems only generate GAE code for Java, does it support to generate GAE code for python?
 
Right... only java today to match the android code on the client. Who else would like to see python in the server?
 
+Preetham Varghese What OS are you running? Also, could you try again with an updated version of Android Studio (Android Studio->Check for Updates) and a new app?
 
I notice a small discrepancy in the doc: CloudEndpointUtils.java is in the <app name>-endpoints module, not under the -AppEngine module.
 
I can't seem to upload the GAE project. When I run appengine:update it tells me at the end that the URL is not found, although it seems I have setup everyting as instructed. I have tried from scratch 4 times now. The project ID is apihaute.

Any suggestions?
 
As soon as I run "Generate App Engine Backend," I get two alerts: "Android framework is detected in the project" and "Gradle 'Project' project refresh failed: Project is using an old version of the Android Gradle plug-in." This is on a clean slate AS 0.2.0 install and newly created project.
 
Ah yes, I believe the gradle android plugin version we have in the generated build.gradle in the '<projectname>-endpoints' module is incorrect.  It will be changed in our new build.  But till then you can edit it and change the line (line 6 if unedited):

classpath 'com.android.tools.build:gradle:0.4.0'

to

classpath 'com.android.tools.build.:gradle:0.5+'
 
EDIT - That did the trick!
 
I have been trying this repeatedly. I create a new project, execute the plug in. It creates the AppEngine module but the the endpoint module isn't generated for me.
The last thing I get in the logs is:
[INFO] Google App Engine Java SDK - Generate endpoints api config...

and then nothing...

Everything compiles just fine. Any tips?
 
+Diego Bao Make sure you have maven installed and environment variable M2_HOME set before you generate the cloud endpoints.
 
I have the problem with the endpoint module not being generated. It worked one time though. When it did generate it however, this was always displayed (and the software halted), "Please enter code: ". And it waits for an input. I have no idea what to put there.

Edit: When I perform the installation, no error message occurs. It just finishes the process with exit code 0.
 
I have the endpoint module problem too, this is the error:

null
java.lang.NullPointerException
at java.io.File.<init>(File.java:334)
at com.google.gct.intellij.endpoints.externalbuilder.MavenEndpointGeneratorHelper.expandSourceDirForApi(MavenEndpointGeneratorHelper.java:125)
at com.google.gct.intellij.endpoints.externalbuilder.MavenEndpointGeneratorHelper.expandSourceDirForApi(MavenEndpointGeneratorHelper.java:392)
at com.google.gct.intellij.endpoints.externalbuilder.ui.GenerateMavenBackend$1$1.onBuildCompleted(GenerateMavenBackend.java:142)
at com.google.gct.intellij.endpoints.util.MavenUtils$2$1.run(MavenUtils.java:121)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:347)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:686)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:514)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
 
My son's tablet is lost. We installed lookout & where's my droid remotely from pc to the tablet. However, neither is working. How can we locate the tablet?
 
I followed the steps in the blog. The App Engine application and the endpoints module were created, but there is no RegisterActivity.java class inside the endpoints module. 
Following error occured (SVWTT is the appname):

Gradle 'SVWTTProject' project refresh failed:
         Project with path ':SVWTT-endpoints' could not be found in project ':SVWTT'.
         Build file 'C:\Users\Wolfi\AndroidStudioProjects\SVWTTProject\SVWTT\build.gradle' line: 34

I have no idea what to do! Can sombody help me?
Thanks a lot!
 
Did you happen to see any other errors during backend creation? Anything in the logs? "Help->Show Logs in Files".  When the backend is created successfully, RegisterActivity.java shows up in the "SVWTT-endpoints" module under src/main/java.  Secondly the Gradle error is because backend generation adds an "include" to the build.gradle file in your Project (the root project), and it seems to be unable to find the SVWTT-endpoints project.  It looks like the "-endpoints" module had some issues during generation?  Do you have any more information that might help us figure it out?
 
+Wolfgang Uebel Same problem here. No RegisterActivity.java generated. Stuck in that phase, unable to continue the tutorial. +Brad Abrams: Help will be very appreciated! 
 
Any specific error message? Any indication in the IDE that something went wrong?
 
Ok now I tried this tutorial with Android Studio 0.3.0.
The automatically generated endpoints module has an outdated build.gradle, I had to change it manually in order to compile it successfully. In addition, I had to include the generated endpoints module myself as a dependency. And third, I was forced to download the depracated GCM library from the SDK, which is weird.
 
The build.gradle issue is being addressed at the moment.  It is a known bug.

We are working on modifying the sample to no longer need GCM, stay tuned.
 
Awesome! I'm really looking forward to Android+AppEngine to work out of the box in Android Studio (sadly, not the current situation), as this is by far my preferred IDE!
 
+Appu Goundan How's it going modifying the sample? Does it mean you will update the "Generate Appengine Backend" in Android Studio?  I tried this in 0.3.6 and getting same problem as +Ariel Haviv. I don't wanna download a deprecated gcm.jar. Please update Android Studio.
 
We're upgrading the sample to use gradle as the build tool for the sample, and also updating the gradle appengine plugin for endpoints.  The cloud tools plugin for studio is undergoing some changes that will be available soon that will solve most of the compatibility problems from using maven with gradle.  It will also bring some changes to the way appengine projects are created.  Please stay tuned.
 
Aiming to be ready in the next month.  There are some dependencies that are out my control, but those seem like there moving along fine.

If you want to just play around with the appengine Gradle plugin in the meantime (no endpoints yet, it's being readied), the docs and source are here : https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
 
I'd love if this actually worked.  I have maven installed, and my M2_HOME variable pointing to it.  I switched from 3.1.1 back down to 3.0.5 per something I read.  I tried pointing the path directly to maven in the android studio prefs.  I've wasted enough time for today on this half baked crap.
 
+Joel Schnall What isn't working?  Perhaps we could walk through it.  The Cloud Tools Plugin is in early stages of development, telling us what is wrong will help us stabilize and improve it.  Also as we transition to a gradle build for App Engine, hopefully the build related issues disappear.
 
I tried doing this. When I do the appengine:update it opens a browser window and ask me to copy and paste a code. Anyone run into this same problem?
 
It's asking you to authorize using oauth2 instead of entering your username and password.  I believe you will see a prompt in the console window where you can copy the code when it prompts.
 
+Mark Gillespie version 0.4 of Android Studio 'imports Eclipse projects' (it's pretty bleeding edge software so expect bugs) ...
 
Gradle 'UGHO' project refresh failed: Premature end of Content-Length delimited message body (expected: 264204; received: 50232). Helppppp Android Studio 0.4.6
 
Too bad this ended up being a discussion of Android Studio and the pain of moving from eclipse. The backend generator is what was supposedly going to be discussed here. Has anyone used it??
 
I tried unsuccessfully a few releases ago. Probably should try again now, maybe it's working now. 
 
Actually, I ended up getting this to work. Pretty psyched about it. Documentation/guides are just poor. This is a HUGE opportunity for Google both as a way to draw people to their cloud offerings and because iCloud has been a disaster from a programmer perspective. But jesus, if you have a wizard, that claims to get you up and running, make sure it works.. lol.
Add a comment...