1

I am working with Google API, so I added this script to build.gradle file (inside app/ folder in my project) but I am getting errors "failed to resolve:com.google.apis: please help.

apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.gmailquickstart" minSdkVersion 11 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.google.android.gms:play-services:7.3.0' compile 'com.google.api-client:google-api-client:1.20.0' compile 'com.google.api-client:google-api-client-android:1.20.0' compile 'com.google.api-client:google-api-client-gson:1.20.0' compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0' } 

1 Answer 1

1

It looks like you want to have this code in your build.gradle:

repositories { mavenCentral() } dependencies { compile 'com.google.apis:google-api-services-gmail:v1-rev33-1.20.0' } 

reference: https://developers.google.com/api-client-library/java/apis/gmail/v1

Edit: And as according to the reference, you could also download the jar files there to avoid referencing maven, if you wanted.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm not sure I understand. Android is usually coded in Java. Have you tried adding the mavenCentral repository line and seeing if it gave you a different message?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.