问题
I am getting a compile error when I try to run the code shown below:
package com.example.dude.googleapi;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
public class MainActivity extends ActionBarActivity implements GoogleApiClient.OnConnectionFailedListener,GoogleApiClient.ConnectionCallbacks{
GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GDriveLogin();
}
void GDriveLogin(){
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
}
These are the dependencies I have added into the Gradle file:
compile files('libs/android-support-v4.jar')
compile 'com.google.android.gms:play-services:6.5.87'
And, the node in the Manifest file:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and, this is the only compile error I am getting:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/app/NotificationCompatIceCreamSandwich.class
could someone help in resolving this issue?
来源:https://stackoverflow.com/questions/28681019/googledrive-android-api-compile-error