Kevin LE GOFF
Kevin LE GOFF

Reputation: 770

Android Studio Integrating Google Endpoints Generated libraries

I am trying to include a generated client library to query Google Cloud Endpoints to my Android Studio process.

I have included the depedencies libs in /libs folder of the project.

I have unarchived the source of the .jar containing the specific code for the API I am using. And I have copy-pasted it to my source folder.

Project Tree

I am encountering compilation error in the generated API files when I try to compile my project.

Here is my builg.gradle file.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
   compileSdkVersion 17
   buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 8
    }
}


dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile 'com.google.android.gms:play-services:3.1.36'
    compile fileTree(dir: "libs/google_end_points/", includes: ['*.jar'])
}

I am getting several compilation error like this (Note com.google.api.services.positivityapi is the generated API from Google Cloud Endpoints):

Gradle: com.google.api.services.positivityapi.Positivityapi.Appreciation.List is already defined in com.google.api.services.positivityapi.Positivityapi.Appreciation

I have several questions :

Thanks for your help

Upvotes: 2

Views: 1194

Answers (1)

PaulR
PaulR

Reputation: 3293

Adjust your build.grade file using this file as an example. This will dynamically pull in the dependencies and prevent you from having to check them in.

https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-android/blob/master/HelloEndpointsProject/HelloEndpoints/build.gradle

If you continue to have missing dependencies make sure you've downloaded the required packages from the SDK manager as specified in the same project's README file:

https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-android

Upvotes: 1

Related Questions