python - Cannot import google cloud endpoints client library class in Android project -


i'm having difficulty getting google cloud endpoints working. have python endpoints project running on gae , works using api explorer. i'm struggling generate client library , use in android app. i've tried number of sample projects , have same problem every time; can't import , use model classes client libraries.

here's i'm doing (for example i'll use helloworld api python sample @ https://github.com/googlecloudplatform/appengine-endpoints-helloendpoints-python)

  1. unzip sample code
  2. generate client library navigating folder , running

    <gae-sdk>\endpointscfg.py get_client_lib java helloworld_api.helloworldapi 
  3. unzip generated folder , copy root of project in eclipse

  4. in eclipse add "your_app_id_appspot_com-helloworld-v1-20140310110152-java-1.17.0-rc-sources.jar" build path (right click jar> build path>add build path)

at stage, can import com.appspot.your_app_id.helloworld.model.*but cannot import com.appspot.your_app_id.helloworld.model.greeting

can shed light on what's happening here? have tried many different ways work have same problem every time.

many thanks,

tom

the problem default, generated zip file contains sources jar, not actual compiled library jar android app can use.

here's solution:

  1. in backend api folder (from same place app.yaml located), generate client library gradle library, so:
    <gae-sdk-path>\endpointscfg.py get_client_lib java -bs gradle helloworld_api.helloworldapi

  2. you'll have helloworld-v1.zip. unzip (either right here or in somewhere convenient ~/temp)

  3. this create folder called helloworld, should have build.gradle in there along src folder.

  4. build client library using "gradle install" in folder.

  5. copy build/libs/helloworld-v1-1.x.x-snapshot.jar android app's libs folder.

  6. add library in android studio right-click/add-as-library.

  7. your classes should resolve correctly.

step 4 should install just-built client library local maven repository. can follow instructions in readme.html in helloworld/ folder extracted integrate directly android app's gradle build system instead of copying jar built manually.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -