Generating Google Cloud Endpoints Android client classes from Python project
Question: I have coded and tested a Python Endpoints server-side for an Android app that
I'm building.

The coded server-side works perfectly on the API Explorer. I'm also able to
generate the zip containing the classes jar file, but when I import it, either
on Eclipse or on Android Studio, I'm unable to use it's classes on my Android
Project.

On Eclipse, under Android Private Libraries, I can see the model module, but
none of it's classes. The main API classes are also missing.

On Android Studio, I can see all the classes when I expand the included jar
file, but I'm unable to use any of them on my project as they do not resolve,
even after a manual import. It seems that AS is properly importing the JAR as
a lib, as while typing the import line on any of the project classes, auto-
complete works, but it is missing all the classes.

Here is the command I'm using to generate the JAR file:

    
    
    endpointscfg.py get_client_lib java --hostname localhost:8080 main.MyApi
    

My services class starts as following:

    
    
    @endpoints.api(name='myapi', version='v1')
    class MyApi(remote.Service):
    

I'm doing something wrong?

Also, from the java classes zip file, should I import into my Android project
all the jar files contained by the libs directory?

Thanks in advance.

* * *

**More information:**

The generated jar contains a main class as follows:

    
    
    public class MyApi extends  com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
    
    }
    

and this main class has the following inner class:

    
    
    public class Blob {
    
        public Request request(java.lang.String type) throws java.io.IOException {
          Request result = new Request(type);
          initialize(result);
          return result;
        }
    

The inner class Blob has the bellow error on it's Request result object:

    
    
    initialize (com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?>)  in MyApi cannot be applied to  (com.appspot.trim_bot.myapi.MyApi.Blob.Request)
    

* * *

**Added on April 16th:**

It seems that the compiled EndPoints classes cannot resolve their
dependencies.


Answer: I had a similar problem and I worked around it doing the following. Take note
that this is probably not the most efficient way of doing it.  

* my app engine project is set to run with ant, so I generate the library using   
$/appengine-java-sdk/bin/endpoints.sh get-client-lib name.MessageEndpoint  
$mkdir tmp  
$mv name-v1-java.zip tmp/  
$cd tmp; unzip name-v1-java.zip; jar -xvf name_appspot_com-foo-v1.jar  
$mv com {root of android studio project/src/main/java}  

* edit src/build.gradle in android studio, add the list of jar that were added when building the endpoint client library.  
  
compile(group: 'com.google.api-client', name: 'google-api-client-appengine',
version: '1.18.0-rc')  
compile(group: 'com.google.api-client', name: 'google-api-client-gson',
version: '1.18.0-rc')  
....  
  
rebuild and it looks like it is working.

