GoogleDrive Android API Compile error:

£可爱£侵袭症+ 提交于 2019-12-13 17:54:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!