java.lang.NoSuchFieldError:没有类型为Lcom / google / android / gms / common / ConnectionResult的静态字段zzakj

时间:2017-08-04 02:02:49

标签: google-signin

我按照Google开发者中的步骤操作,然后我可以运行登录演示。

  1. 将依赖项添加到项目级build.gradle

    classpath 'com.google.gms:google-services:3.0.0'
    
  2. 将插件添加到您的应用级build.gradle:

    apply plugin: 'com.google.gms.google-services'
    
  3. 在您的应用级build.gradle文件中,将Google Play服务声明为依赖项:

    apply plugin: 'com.android.application'
    ...
    
    dependencies {
        compile 'com.google.android.gms:play-services-auth:9.8.0'
    }
    

    这是我的项目build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.1.0'
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
     }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    这是我的app build.gradle

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "net.kdapp.partygor"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }
    
        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')
    
        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
            jniDebuggable false
           //signingConfig signingConfigs.cic
            renderscriptDebuggable false
        }
    debug {
            debuggable true
            jniDebuggable true
            renderscriptDebuggable true
           //signingConfig signingConfigs.cic
            minifyEnabled true
        }
      }
    }
    repositories {
        mavenCentral()
    }
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        })
    
        // 日曆視圖自定義 view
        // 雙向 seekBar
        // 輪播圖
        compile 'com.android.support:support-v4:25.3.1'
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:design:25.3.1'
        compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
        compile 'com.daimajia.slider:library:1.1.5@aar'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'com.google.code.gson:gson:2.8.0'
        compile 'com.squareup.okhttp3:okhttp:3.4.1'
        compile 'com.zhy:okhttputils:2.6.2'
        compile 'com.prolificinteractive:material-calendarview:1.4.3'
        compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
        compile 'com.youth.banner:banner:1.4.9'
        compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    
        // Dependency for Google Sign-In
        compile 'com.google.android.gms:play-services-auth:11.0.1'
    
    
        testCompile 'junit:junit:4.12'
        compile project(':redpacketlibrary')
        compile project(':easeui')
        compile project(path: ':pickerview')
        compile files('libs/parse-android-1.13.0.jar')
        compile files('libs/android-support-multidex.jar')
    
      }
    
    
    apply plugin: 'com.google.gms.google-services'
    

    但是当我运行我的项目时,我收到了这个错误。

    08-04 09:34:45.420 22456-22456/net.kdapp.partygor E/AndroidRuntime: FATAL EXCEPTION: main
                                                                    Process: net.kdapp.partygor, PID: 22456
                                                                    java.lang.NoSuchFieldError: No static field zzazX of type Lcom/google/android/gms/common/ConnectionResult; in class Lcom/google/android/gms/common/ConnectionResult; or its superclasses (declaration of 'com.google.android.gms.common.ConnectionResult' appears in /data/data/net.kdapp.partygor/files/instant-run/dex/slice-google-play-services_78c2c5fe145c1c95c9696f0679d986433b0c2b89-classes.dex)
                                                                        at com.google.android.gms.common.internal.zzo.zzrj(Unknown Source)
                                                                        at com.google.android.gms.common.internal.zze.zzs(Unknown Source)
                                                                        at com.google.android.gms.common.internal.zzi.zzrk(Unknown Source)
                                                                        at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:111)
                                                                        at android.os.Looper.loop(Looper.java:194)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5877)
                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                        at java.lang.reflect.Method.invoke(Method.java:372)
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1019)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:814)
    

    我在Google上多次搜索并更改了google-services api版本,但它仍然没有用。

0 个答案:

没有答案