在应用启动时突然获取Firebase java.lang.IllegalAccessError [英] Suddenly getting Firebase java.lang.IllegalAccessError at startup of app

查看:96
本文介绍了在应用启动时突然获取Firebase java.lang.IllegalAccessError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装后首次启动应用时突然崩溃!但是只是第一次...在第二次打开应用程序后它可以正常工作。

suddenly a crash occurs at initial startup of app after installation! But just the first time...after second opening of app it works properly.

我没有更改firebase代码,但可能没有更改依赖项...但是最新的版本...所以通常它应该是一个稳定的版本!

I have not changes the firebase code but maybe the dependency...but to the latest version...so normally it should be a stable one!

似乎有一些与firebase相关的问题:


java.lang.IllegalAccessError:非法的类访问:
'com.google.firebase.messaging.zze'试图访问
' com.google.firebase.iid.zzat($。b $ b'com.google.firebase.messaging.zze'的声明出现在base.apk中)

java.lang.IllegalAccessError: Illegal class access: 'com.google.firebase.messaging.zze' attempting to access 'com.google.firebase.iid.zzat' (declaration of 'com.google.firebase.messaging.zze' appears in base.apk)

我的配置:

My Configurations:

Build.gradle(项目)

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/' } //for OneSignal
        maven { url 'https://maven.fabric.io/public' } //for CrashLytics
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'io.fabric.tools:gradle:1.31.0'  // Crashlytics plugin

        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5' //for OneSignal

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

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

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

***************** Build.gradle(Module:app)*************** ************

*****************Build.gradle (Module:app)***************************

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: 'com.android.application'

apply plugin: 'io.fabric'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

android {
    signingConfigs {
        release {
               ....
        }
        debug {
            ....
        }
        staging {
            ....
        }
    }
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 26
        targetSdkVersion 29
        versionCode 43
        versionName "1.0.20"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [
                onesignal_app_id               : '....',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]
    }
    buildTypes {
        debug {
            minifyEnabled false
            debuggable true
            buildConfigField "String", "BASE_URL", "\"http://....:8080\"" //http://....:8080
//            buildConfigField "String", "BASE_URL", "\"http://....:8080/....\"" //http://...:8080
        }
        staging {
            minifyEnabled false
            debuggable true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "BASE_URL", "\"http://....:8080/....\""
            signingConfig signingConfigs.staging
        }
        release {
            minifyEnabled false
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "BASE_URL", "\"http://....:8080/....\""
            signingConfig signingConfigs.release
        }
    }

    //Google introduced a new App Bundle format to split apk files in smaller sizes when they’re being installed on the client devices.
    //However, this means that we cannot have dynamic language changes in our applications.
    //To prevent that split for language files we need to add extra lines in our build.gradle file inside the app folder like below.
    bundle {
        language {
            enableSplit = false //this setting is needed to enable dynamic switch of language in app.
        }
    }

    dataBinding {
        enabled true
    }

}

//Date for APK File name (info: When deploying on Google Play Store, this date will be included in VersionName as suffix, e.g. 1.0_2019-07-12)
static def getDate() {
    def date = new Date()
    def formattedDate = date.format('YYYY-MM-dd')
    return formattedDate
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0' //1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //Android Architecture Components
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'

    //OkHttp OAuth2 client
    implementation 'ca.mimic:oauth2library:2.4.2'

    //Anko
    implementation "org.jetbrains.anko:anko:0.10.8"

    //Firebase
    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.google.firebase:firebase-auth:19.2.0'

    //Crashlytics
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

    implementation 'androidx.cardview:cardview:1.0.0'

    //Google Maps
    implementation 'com.google.android.gms:play-services-maps:17.0.0'

    //OneSignal
    implementation 'com.onesignal:OneSignal:3.10.9'

    //Picasso
    implementation 'com.squareup.picasso:picasso:2.71828'

    //GIF ImageView
    //implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'

    //Jackson
    implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"

    //Volley
    implementation 'com.android.volley:volley:1.1.1'

    //SegmentedButton
    implementation 'com.github.ceryle:SegmentedButton:v2.0.2'

    //EasyValidation
    implementation "com.wajahatkarim3.easyvalidation:easyvalidation-core:1.0.1"

    //QuickPermissions-Kotlin
    implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.4.0'

}

apply plugin: 'com.google.gms.google-services'


推荐答案

根据官方文档

不再添加Android库 com.google.firebase:firebase-core
此SDK包括用于 Google Analytics(分析)的Firebase SDK。现在,要使用
Analytics(或需要或建议使用
的任何Firebase产品),您需要显式添加Google Analytics(分析)
依赖项:

No longer add the Android library com.google.firebase:firebase-core. This SDK included the Firebase SDK for Google Analytics. Now, to use Analytics (or any of the Firebase products that require or recommend the use of Analytics), you need to explicitly add the Analytics dependency:

com.google.firebase:firebase-analytics:17.2.2

所以,不需要在项目中添加 com.google.firebase:firebase-core 删除

这篇关于在应用启动时突然获取Firebase java.lang.IllegalAccessError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆