I am creating a backend GAE project with Cloud Endpoints. I want also to create an Android application that will consume these endpoints, and I found in the documentation here that I have to copy the java source classes to my Android project to access to the endpoints. I really don't like this approach thinking in the case that I am developing the endpoints for a external client (I don't want to give them my source code, I prefer just give them a jar library to avoid complexity).
I found reading the README file also generated with the endpoints that The generated service-specific library can be found in the top level directory
of the zip file:
google-api-services-noteendpoint-v1-rev20130920182043-1.16.0-rc.jar. But this jar is not generated anymore.
So, copying the source classes is the only way to pass the access to the endpoint to the Android project? Where is this jar that once was supposed to be created?
Thanks so much.
Ok, I found the answer, the jar is not generated but can be generated by maven. The endpoints created has maven structure and you only have to package it to get the final jar. Tested and working.
On eclipse, with Google plugin, clicking on the appengine project you can select:
Google->Generate Cloud Endpoint Client Library, you need to have an associated android project. You can create a android associated project, selecting, when creating a new project: AppEngine Connected Android Project.
Related
I've just followed exactly what was said in this tutorial and ran the command
/usr/local/google_appengine/endpointscfg.py get_client_lib java -bs gradle helloworld_api.NewsApi
I know my NewsApi service works, I've tested it on the Google APIs explorer.
I get a success message: API client library written to ./getNews-v1.zip
I extracted the zip and found the following files inside the folder (getNews):
No JAR file exists!! What do I use to set up the library in my Android client?
Any ideas? Thanks!
If you want a sources JAR and included dependencies to include in your project use '-bs default' or simply omit that option. Using '-bs gradle' or '-bs maven' assumes you are going to use one of those build tools to build a classes JAR yourself. The 'endpointscfg.py' of course won't compile sources to class files for you as it doesn't have knowledge of any Java environment.
More info in the docs:
https://cloud.google.com/appengine/docs/python/endpoints/endpoints_tool
I am working on an android project working in Android Studio (0.5.3).
I have created two endpoint api classes (called UserEndpoint and OfferEndpoint) in the backend part of the project. Then I wanted to create the client libraries to use in the app part of the project. I use the gradlew appengineEndpointsInstallClientLibs command for this. In the /build/client-libs part it did create the .zip files of the client libraries. But it did not install them in the app part of the project.
So now my question:
Is the command I am using (gradlew appengineEndpointsInstallClientLibs) supposed to also install them in the app part, and if yes what could be the reason it is not working for me (there seem to be no errors).
This tutorial mentions that I have to manually add the libraries. I added the .zip files to the /libs folder, but there is no 'add as library' option as the tutorial mentions. Is this the correct way of doing this? And if yes could someone give me a little more in detail explanation because I tried some things by adding the dependency in the build.gradle file but nothing seems to work.
Thanks in advance!
By default, if you don't use #ApiNamespace, the namespace that is used
is the reverse of your-project-id.appspot.com. That is, the package
path will be com.appspot.your-project-id.yourApi.
Source
The annotation was missing in the #Api annotations of the endpoints.
I have a LibraryProject that uses Amazon AWS with ProductionApps that use the LibraryProject (as a library).
My new ProductionApp uses GoogleAppEngine with autogenerates libraries for use in the app. The problem is when I try to build the new app, I get the following error:
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/codehaus/jackson/Base64Variant;
Through trial and error I found that the offending library (in LibraryProject) is is amazon-aws-sdk-1.6.0-core.jar (required to use Amazon AWS).
How can I resolve the error and still use AWS and GAE?
From your log it looks like the problem is that both Amazon AWS and GoogleAppEngine each include the same class in their library, so assuming that the offending classes are largely identical in Amazon & Google code, possible solutions are:
A. delete those classes from GAE lib, as your main project would still have access to the version provided by Amazon AWS, or
B. extract those classes into its own jar and delete them from both versions, or
C. if the related GAE libs are auto-generated by Eclipse plugin, extract them from GAE into its own jar (but don't delete them from GAE lib), and have Amazon AWS lib project reference the extracted jar (but don't export it)
Try deleting android-support-v4.jar file. I believe Amazon or Google will take care of it. If that doesn't work let me know so I can figure.
I'm developing an Android app with Play framework as backend. There are some classes that are common between the client and server side projects.
If I create a library project or a shared folder in Eclipse, and link the classes to both projects, Play complains that it cannot find the classes, (maybe because it has to be in a folder called 'app'?)
Is it possible to share code between client and server side projects using Play framework?
I don't know the Play framework, but if you create a library in Eclipse, instead of linking to it in the build path you must add it as a library in the android settings of your project. (You find them by selecting your project and pressing alt+enter)
Play uses his own classloader and classpath. So you must put your classes into a jar and this into the lib. Or you create a module for the shared code.
What I ended up doing was link the 'app' folder and specify an inclusion pattern for the shared package.
the problem with jar is that the server needs to be restarted everytime it changes, the source needs to be repackaged and the project needs to be re-eclipsified. As for the library project, i'm not using any android specific code in the shared folders
The way to do it would be:
Create a new project with the code to share. This should provide an API to do what you want to do.
Build the project as a JAR
Link the Jar on PLay (drop it on lib folder) and Android
I try to implement a restful client on android via Jersey library. It works pretty well in a Java project. But when I do it in a android project, always come up an exception: could not find class "com.sun.jersey.api.client.config...." It seems that the library cannot be found even I have added it in the build path.
I believe Jersey currently is not ported to Android. But for example Restlet does explicitly support Android and also implements the same API (JAX-RS).
The jar file needs to physically be located in the directory /libs in your project to be included into the distributed apk and linked to the app at runtime.