3
votes

I built a Cloud Endpoints API using AppEngine/Python (not with the Java wizard from Android Studio), then I generated the libs and sources, copied the libs stated in the tutorial to libs/ and extracted the sources.jar file to src/

adding to build.gradle: compile fileTree(dir: 'libs', include: '*.jar')

the problem I'm now facing is:

08-04 19:40:53.756    2052-2052/com.dgt.ddst E/dalvikvm: Could not find class 'com.google.api.services.dsApi.DsApi$Builder', referenced from method com.dgt.ds.MainActivity$1.doInBackground
08-04 19:40:53.756    2052-2052/com.dgt.ds E/dalvikvm: Could not find class 'com.google.api.services.dsApi.model.ServicesDResponse', referenced from method com.dgt.ds.MainActivity$1.onPostExecute

I searched for solutions and all I could find are things related to Eclipse.

how do I fix this in the Android Studio/Gradle environment ?

1
Can you expand on what "com.google.api.services.dsApi" is?loosebazooka

1 Answers

0
votes

This is how I did it, maybe it is not the best way but I couldn't find a better one:

  • First generate your client library for gradle:

    google_appengine/endpointscfg.py get_client_lib java -bs gradle your_module.YourServiceClass

  • Uncompress the generated zip file, this will create a folder call your_module

  • In Android Studio load the Android app you want to work with your endpoints module

  • Go to File -> Project Structure. Add a new module selecting "Import existing project". Point the source folder to your_module folder and then press finish.

  • Android Studio will go back to the Project Structure window, select your Android app module and go to the dependencies tab. Add a new "Module dependency" and select your_module.

  • Re-sync gradle and rebuild your project and that's all!