Google云端硬盘的Android API编译错误:(GoogleDrive Android AP

2019-10-22 01:52发布

我得到一个编译错误,当我尝试运行的代码如下所示:

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();
    }

}

这是我已经加入到摇篮文件的依赖关系:

compile files('libs/android-support-v4.jar')

compile 'com.google.android.gms:play-services:6.5.87'

而且,在清单文件中的节点:

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

并且,这是我收到的唯一的编译错误:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/app/NotificationCompatIceCreamSandwich.class

可能有人在解决这一问题上需要帮助?

文章来源: GoogleDrive Android API Compile error: