本文介绍了致命异常:java.lang.NoClassDefFoundError com.google.android.gms.internal.firebase-perf.zzw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用启动时遇到此错误.

Getting this Error on app launch.

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

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:3.2.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        classpath 'io.fabric.tools:gradle:1.24.4'


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

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        google()
    }
}

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

//

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
apply plugin: 'io.fabric'
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.abc.xyz"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 18
        versionName "1.9"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }

//Signing configurations for build variants "release"
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support.constraint:constraint-layout:1.1.2'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.5.0'
    compile 'com.android.support:support-vector-drawable:27.1.1'
    compile 'com.google.firebase:firebase-crash:16.0.1'
    compile 'com.google.firebase:firebase-messaging:17.3.0'
    compile 'com.google.firebase:firebase-config:16.0.0'
    compile 'com.google.android.gms:play-services-location:15.0.1'
    compile 'com.google.android.gms:play-services-maps:15.0.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.firebase:firebase-auth:16.0.3'
    compile 'com.google.android.gms:play-services-auth:16.0.0'
    compile 'com.google.firebase:firebase-core:16.0.1'
    compile 'com.google.firebase:firebase-perf:16.1.0'
    compile 'com.google.android.gms:play-services-places:15.0.1'

 compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'

推荐答案

Firebase崩溃版本 firebase-perf版本必须小于或等于 Firebase-core版本,因此只需在代码中将 Firebase-crash:16.0.1版本更改为Firebase-crash:16.0.0 firebase-perf:16.1.0版本为firebase-perf:16.0.0 ,因为您的firebase-core版本为16.0.1

Firebase-crash version and firebase-perf version must be lesser than or equal to the Firebase-core version so In your code just change the Firebase-crash:16.0.1 version to Firebase-crash:16.0.0 and firebase-perf:16.1.0 version to firebase-perf:16.0.0 Because your's firebase-core version is 16.0.1

   compile 'com.google.firebase:firebase-perf:16.0.0'
   compile 'com.google.firebase:firebase-crash:16.0.0'

这篇关于致命异常:java.lang.NoClassDefFoundError com.google.android.gms.internal.firebase-perf.zzw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 16:55