My app has following gradle configurations
- Min Sdk version:15
- Target Sdk version:23
- compile 'com.google.android.gms:play-services-drive:9.6.1'
- classpath 'com.google.gms:google-services:3.0.0'
- Android version 6.0
- Google Play Services version 10.2.98
Also i registered my app on https://console.developers.google.com/apis/credentials
Using the following code for drive api
private void connectToDrive(){
GoogleApiClient.ConnectionCallbacks ccb = new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i("app" , "connected");
}
@Override
public void onConnectionSuspended(int i) {
}
};
GoogleApiClient.OnConnectionFailedListener cfl = new GoogleApiClient.OnConnectionFailedListener(){
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i("app", "GoogleApiClient connection failed: " + connectionResult.toString());
if (!connectionResult.hasResolution()) {
GoogleApiAvailability.getInstance().getErrorDialog(MainActivity.this, connectionResult.getErrorCode(), 0).show();
return;
}
try {
connectionResult.startResolutionForResult(MainActivity.this, 4);
} catch (IntentSender.SendIntentException e) {
Log.e("app", "Exception while starting resolution activity", e);
}
}
};
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(ccb)
.addOnConnectionFailedListener(cfl)
.build();
mGoogleApiClient.connect();
}
This module gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.ali.datastore"
minSdkVersion 15
targetSdkVersion 23
versionCode 3
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile files('libs/jxl.jar')
compile 'com.google.android.gms:play-services-drive:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
and this is project gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
every time i do this it gives following error is having trouble with google play service if problem persists contact the developer. This is Error Message I am using HTC M8 mobile with
For last 3 days of googling i did not get any solution to my problem. What am i missing here?