有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

JAVAlang.NoClassDefFoundError:解析失败:Lcom/google/安卓/gms/common/util/zzq;

我正在尝试将Firebase添加到我的应用程序中。 尽管Gradle构建成功,但应用程序在启动时崩溃,出现以下错误:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/安卓/gms/common/util/zzq;

这是我的应用程序构建。格拉德尔:

apply plugin: 'com.安卓.application'

安卓 {
compileSdkVersion 28
defaultConfig {
    applicationId "some_id"
    minSdkVersion 17
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "安卓.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
    }
}
}

repositories {
    mavenCentral()
jcenter()
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.安卓.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    安卓TestImplementation 'com.安卓.support.test:runner:1.0.2'
    安卓TestImplementation 'com.安卓.support.test.espresso:espresso-core:3.0.2'
/**
 * Library file of the SDK, delivered as aar-library
 */
    implementation(name: 'dwdsdk-3.3.0', ext: 'aar')
/**
 *      additional library needed for DWD-SDK:
 *      play-service: needed to receive push notifications
 */
    implementation 'com.google.安卓.gms:play-services-gcm:11.8.0'
    implementation 'com.安卓.support:appcompat-v7:28.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'

这就是项目建设。格拉德尔:

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

buildscript {

    repositories {
        google()
        jcenter()
    }
dependencies {
    classpath 'com.安卓.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

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

谢谢你的帮助


共 (2) 个答案

  1. # 1 楼答案

    如果您想use Cloud Messaging,请添加

    com.google.firebase:firebase-messaging:17.3.4
    

    并移除你对GCM的依赖

  2. # 2 楼答案

    我和你有类似的问题

    爪哇。lang.NoClassDefFoundError:解析失败:Lcom/google/android/gms/common/util/zzq

    我认为这是版本问题

    你应该更新firebase的最新版本。 这对我很管用。 谢谢