How to move Cloud Endpoints generated sources.jar library to Android project

The Google plugin for Eclipse includes a tool for automatically creating a client cloud endpoint library. But there seems to be no easy way to move the generated source.jar file to your Android source.

Documentation https://developers.google.com/appengine/docs/java/endpoints/consume_android says

Building endpoints leads to a jar file of sources. Add the contents of this jar file to your Android project.

It is not possible to put the source.jar file in Android / lib or / libs, because the source is .java and not the .class form. So I just manually copy the source generated by the GPE (which they put in the lib-endpoints folder in your AppEngine project). This can be extremely cumbersome, especially when you have multiple endpoints and often edit it.

See also Error connecting Android application to Google cloud endpoints: could not find class

Does anyone know how to actually use the sources.jar file directly in an Android project? Thanks.

+4
source share
2 answers

This problem is solved in Eclipse by adding a related resource to the directory

Your-AppEngine-project / LIESA endpoint / libYourEndpoint -v1 / yourendpoint / yourendpoint generated-source /

You can do this in Eclipse by adding the source link in Properties-> Java Build Path-> Source Link

After that, your Android or client project will see any changes generated using "Google-> Generate Client Endpoint Library"

+6
source

The idea is that the wizard that creates the client library also copies it into your client project.

But it depends, for example, how you originally created your projects, and even if it works, what to do if you have several projects with several clients or change the client’s project ... so here are some ideas:

  • I found a file that indicates which project the client libraries will be copied to (in the .settings folder): com.google.gdt.eclipse.appengine.swarm.prefs:

    connectedProject = [-android-project-name of the target]
    eclipse.preferences.version = 1

I manually changed this file for me, but I did not try to manually create it if it does not exist.

  • Another solution you asked for is to manually copy the file. In my case, I was able to copy the generated files from [gae-project] \ endpoint-libs to [android-project] \ endpoint-libs. If I remember correctly, you should find the source jar file (it is among the file that you copied and is easy to find) and extract them into the "[endpoint-name] -v1-generated-source" folder. You create this folder in the same folder where you found the jar.

Clearly this is not a big decision, therefore ..

  • There is an endpoints.cmd / bat point that can be used instead of the GPE wizard. I suggest you see if he has a command to copy and extract the created library. I believe that you will find it in the bin folder in the GAE / J SDK file.
+4
source

Source: https://habr.com/ru/post/1469047/


All Articles