java.lang.NoSuchMethodError:没有静态方法zzb(ZLjava / lang / Object;)类Lcom / google / android / gms / common / internal / zzaa中的V;或者它的超级课程

时间:2017-11-18 10:41:50

标签: java android firebase android-gradle

我查看了Firebase文档,然后搜索了所有github问题以及所有堆栈溢出帖子,但我仍然一次又一次地收到此错误。我被困了几个小时,请看看。它说 -

java.lang.NoSuchMethodError: No static method zzb(ZLjava/lang/Object;)V in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/com.masquerade.priyanshu.topcoder-2/split_lib_dependencies_apk.apk)

根据其他堆栈溢出帖子,当我尝试更改firebase核心和数据库版本时,我得到另一堆错误说不兼容的版本。

这是build.gradle(Module:app)

apply plugin: 'com.android.application'
repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.masquerade.priyanshu.topcoder"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
//    implementation 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//

    compile 'com.google.firebase:firebase-core:11.6.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.google.firebase:firebase-database:11.6.0'
 compile 'com.firebaseui:firebase-ui-storage:1.0.0'
    // Displaying images
    compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:cardview-v7:21.+'
}
apply plugin: 'com.google.gms.google-services'

这是build.gradle(Project:app) -

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        maven {
            url 'https://maven.fabric.io/public'
        }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

编辑 - 我也在compile 'com.google.firebase:firebase-core:11.6.0'

收到此警告

警告是 -

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.6.0, 11.4.2. Examples include com.google.android.gms:play-services-basement:11.6.0 and com.google.firebase:firebase-storage:11.4.

1 个答案:

答案 0 :(得分:1)

要解决此问题,请从build.gradle(Project:app)文件更改以下代码行:

url 'https://maven.fabric.io/public'

url "https://maven.google.com" // Google's Maven repository

也改变这行代码:

compile 'com.firebaseui:firebase-ui-storage:1.0.0'

compile 'com.firebaseui:firebase-ui-storage:3.1.0'

也改变这行代码:

compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'

compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'

因为Firebase/Play Services Version 11.4.2FirebaseUI Version 3.1.0 multiDexEnabled一起工作,所以here

在默认配置中也将from __future__ import print_function # if you are using python2.7 i = open("input","r") f = open("output.txt","w") a = "awesome" for line in i: #iterate lines in file input line.strip() #this will remove the \n in the end of the string print(line,end=" ",file=f) #this will write to file output with space at the end of it 设置为true。