Firebase在Android中崩溃

时间:2018-04-23 17:44:45

标签: android firebase

我正在开发一个与firebase相关联的应用。工作4个月后,我收到此错误。这是我的Logcat:

    04-23 23:02:19.368 1725-1725/? I/art: Late-enabling -Xcheck:jni
04-23 23:02:20.407 1725-1725/com.cofoz.cofoz W/System: ClassLoader referenced unknown path: /data/app/com.cofoz.cofoz-1/lib/arm
04-23 23:02:20.715 1725-1725/com.cofoz.cofoz W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
04-23 23:02:20.719 1725-1725/com.cofoz.cofoz W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
04-23 23:02:20.746 1725-1725/com.cofoz.cofoz I/BiChannelGoogleApi: [FirebaseAuth: ] No Fallback module; NOT setting up for lazy initialization
04-23 23:02:20.762 1725-1725/com.cofoz.cofoz D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
04-23 23:02:20.782 1725-1752/com.cofoz.cofoz W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
04-23 23:02:20.832 1725-1752/com.cofoz.cofoz I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
    [FirebaseAuth:] Preparing to create service connection to gms implementation
04-23 23:02:20.876 1725-1725/com.cofoz.cofoz V/FA: Cancelling job. JobID: 8573555
04-23 23:02:20.887 1725-1725/com.cofoz.cofoz V/FA: Registered activity lifecycle callback
04-23 23:02:20.889 1725-1725/com.cofoz.cofoz I/FirebaseInitProvider: FirebaseApp initialization successful
04-23 23:02:20.896 1725-1725/com.cofoz.cofoz I/art: Rejecting re-init on previously-failed class java.lang.Class<com.firebase.ui.auth.provider.TwitterProvider>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/twitter/sdk/android/core/Callback;
        at void com.firebase.ui.auth.AuthUI.setApplicationContext(android.content.Context) (AuthUI.java:217)
        at boolean com.firebase.ui.auth.data.client.AuthUiInitProvider.onCreate() (AuthUiInitProvider.java:29)
        at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1751)
        at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1726)
        at void com.firebase.ui.auth.data.client.AuthUiInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (AuthUiInitProvider.java:23)
        at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:5852)
        at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5444)
        at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5383)
        at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1541)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
        at void android.os.Looper.loop() (Looper.java:154)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6123)
        at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:867)
        at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:757)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.twitter.sdk.android.core.Callback" on path: DexPathList[[zip file "/data/app/com.cofoz.cofoz-1/base.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.cofoz.cofoz-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.cofoz.cofoz-1/lib/arm, /system/lib, /vendor/lib]]
        at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
        at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
        at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
        at void com.firebase.ui.auth.AuthUI.setApplicationContext(android.content.Context) (AuthUI.java:217)
        at boolean com.firebase.ui.auth.data.client.AuthUiInitProvider.onCreate() (AuthUiInitProvider.java:29)
        at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1751)
        at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1726)
        at void com.firebase.ui.auth.data.client.AuthUiInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (AuthUiInitProvider.java:23)
        at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:5852)
        at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5444)
        at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5383)
        at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1541)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
        at void android.os.Looper.loop() (Looper.java:154)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6123)
        at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:867)
        at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:757)
04-23 23:02:20.901 1725-1725/com.cofoz.cofoz I/InstantRun: starting instant run server: is main process
04-23 23:02:20.907 1725-1774/com.cofoz.cofoz V/FA: Collection enabled
    App package, google app id: com.cofoz.cofoz, 1:469934280646:android:3c290afc0d1894b6
04-23 23:02:20.909 1725-1774/com.cofoz.cofoz I/FA: App measurement is starting up, version: 11910
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.cofoz.cofoz
04-23 23:02:20.909 1725-1774/com.cofoz.cofoz D/FA: Debug-level message logging enabled
04-23 23:02:20.929 1725-1774/com.cofoz.cofoz V/FA: Connecting to remote service
04-23 23:02:20.950 1725-1774/com.cofoz.cofoz V/FA: Connection attempt already in progress
04-23 23:02:20.961 1725-1725/com.cofoz.cofoz W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
04-23 23:02:21.295 1725-1725/com.cofoz.cofoz W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
04-23 23:02:21.307 1725-1725/com.cofoz.cofoz V/FA: onActivityCreated
04-23 23:02:21.602 1725-1725/com.cofoz.cofoz W/linker: /data/app/com.google.android.gms-2/lib/arm/libconscrypt_gmscore_jni.so: unused DT entry: type 0xf arg 0x194
04-23 23:02:21.604 1725-1725/com.cofoz.cofoz V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 280 native methods...
04-23 23:02:21.663 1725-1725/com.cofoz.cofoz D/NetworkSecurityConfig: No Network Security Config specified, using platform default
04-23 23:02:21.666 1725-1725/com.cofoz.cofoz I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
04-23 23:02:21.690 1725-1725/com.cofoz.cofoz D/AndroidRuntime: Shutting down VM
04-23 23:02:21.849 1725-1738/com.cofoz.cofoz I/art: Starting a blocking GC HeapTrim
04-23 23:02:22.680 1725-1733/? I/art: Debugger is no longer active
    Starting a blocking GC Instrumentation
04-23 23:02:50.828 1725-1755/? E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
04-23 23:03:50.845 1725-1755/? E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
04-23 23:05:20.864 1725-1755/? E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
04-23 23:07:50.885 1725-1755/? E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE

我只看到app上的白色屏幕。 这是我的构建gradle文件。 请提供一些解决方案。

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.cofoz.cofoz"
        buildToolsVersion '27.0.3'
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 5
        versionName "1.0.3"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    useLibrary 'org.apache.http.legacy'
    dexOptions {
        javaMaxHeapSize "2g"
        preDexLibraries true

        jumboMode true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // Disables PNG crunching for the release build type.
            crunchPngs false

        }
    }

    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:support-v13:27.0.2'
    implementation 'com.android.support:animated-vector-drawable:27.0.2'
    implementation 'com.android.support:mediarouter-v7:27.0.2'
    implementation 'com.android.support:support-compat:27.0.2'
    implementation 'com.android.support:support-dynamic-animation:27.0.2'
    implementation 'com.android.support:palette-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:animated-vector-drawable:27.0.2'
    implementation 'com.android.support:customtabs:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    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'

    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'


    implementation 'com.github.andremion:counterfab:1.0.1'

    implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
    implementation 'com.google.firebase:firebase-auth:11.8.0'

    //implementation 'com.jakewharton:butterknife:8.8.1'

    implementation 'com.firebaseui:firebase-ui-firestore:3.2.2'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'

    // Required only if Facebook login support is required
    //implementation 'com.facebook.android:facebook-android-sdk:4.27.0'

    implementation 'com.github.bumptech.glide:glide:4.4.0'
    //implementation 'com.github.DanielMartinus:Stepper-Touch:0.6'
    //implementation 'com.stone.vega.library:VegaLayoutManager:1.0.6'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'

    implementation 'com.google.code.gson:gson:2.8.2'
    //implementation'com.google.firebase:firebase-invites:11.8.0'

    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.airbnb.android:lottie:2.2.5'


    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.google.android.gms:play-services-location:11.8.0'

    //implementation 'com.mcxiaoke.volley:library-aar:1.0.0'

    implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'

    //implementation 'com.github.GrenderG:Toasty:1.2.8'
    implementation 'com.github.d-max:spots-dialog:0.4@aar'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.0'
    //implementation 'com.github.ganfra:material-spinner:2.0.0'
    //implementation 'com.google.android.gms:play-services-identity:11.8.0'
    //implementation 'com.github.thomper:sweet-alert-dialog:v1.4.0'
    // Shimmer
    implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'

    implementation 'com.karumi:dexter:4.2.0'
    implementation 'com.google.android.gms:play-services-places:11.8.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'com.github.medyo:android-about-page:1.2.4'
    implementation 'net.danlew:android.joda:2.9.9.3'
    implementation 'com.instabug.library:instabug:4.13.1'
    implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'

}

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

我也尝试过替换google-services.json文件。但我仍然得到同样的错误。

2 个答案:

答案 0 :(得分:1)

您的崩溃是由以下异常引起的:

  

引起:java.lang.ClassNotFoundException:没找到类   &#34; com.twitter.sdk.android.core.Callback&#34;

您是否检查过您正在导入Twitter SDK?您还应该检查这是multi-dex issue

答案 1 :(得分:1)

虽然文档表明如果您未启用该提供程序的登录,则不需要包含auth提供程序的SDK,但我已经看到许多与不包括相关的问题(崩溃或日志消息)报告SDKs。例如,请参阅this onethis onethis one

FirebaseUI文档表明版本3.3.0中发布了更改以解决其中一些问题。我认为您唯一的选择是升级到3.3.0,希望修复程序可以解决您的问题,或include the Twitter SDK,即使您没有使用Twitter登录:

implementation ("com.twitter.sdk.android:twitter-core:3.2.0@aar") { transitive = true }