Android应用程序在logcat中没有任何错误而崩溃

时间:2018-05-06 10:53:40

标签: android firebase google-cloud-firestore

我的应用程序崩溃但没有出现任何错误。我只有一周的时间来启动我的应用程序,但此时我无法追踪错误的位置。这是我的logcat。

        05-06 16:12:49.778 7063-7063/? I/art: Late-enabling -Xcheck:jni
05-06 16:12:49.842 7063-7063/com.cofoz.cofoz W/System: ClassLoader referenced unknown path: /data/app/com.cofoz.cofoz-1/lib/arm
05-06 16:12:49.920 7063-7063/com.cofoz.cofoz D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-06 16:12:49.975 7063-7063/com.cofoz.cofoz V/FA: Registered activity lifecycle callback
05-06 16:12:49.976 7063-7063/com.cofoz.cofoz I/FirebaseInitProvider: FirebaseApp initialization successful
05-06 16:12:50.020 7063-7099/com.cofoz.cofoz V/FA: Collection enabled
05-06 16:12:50.022 7063-7099/com.cofoz.cofoz V/FA: App package, google app id: com.cofoz.cofoz, 1:469934280646:android:3c290afc0d1894b6
05-06 16:12:50.024 7063-7099/com.cofoz.cofoz I/FA: App measurement is starting up, version: 12451
    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
05-06 16:12:50.024 7063-7099/com.cofoz.cofoz D/FA: Debug-level message logging enabled
05-06 16:12:50.030 7063-7063/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.
05-06 16:12:50.039 7063-7099/com.cofoz.cofoz V/FA: Cancelling job. JobID: 8573555
05-06 16:12:50.042 7063-7099/com.cofoz.cofoz V/FA: Persisting first open: 1525603369923
05-06 16:12:50.126 7063-7099/com.cofoz.cofoz V/FA: Updating deferred analytics collection: false
05-06 16:12:50.221 7063-7063/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
05-06 16:12:50.224 7063-7063/com.cofoz.cofoz V/FA: onActivityCreated
05-06 16:12:50.319 7063-7063/com.cofoz.cofoz W/Firestore: (0.6.6-dev) [Firestore]: The behavior for java.util.Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
    To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:

    FirebaseFirestore firestore = FirebaseFirestore.getInstance();
    FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
        .setTimestampsInSnapshotsEnabled(true)
        .build();
    firestore.setFirestoreSettings(settings);

    With this change, timestamps stored in Cloud Firestore will be read back as com.google.firebase.Timestamp objects instead of as system java.util.Date objects. So you will also need to update code expecting a java.util.Date to instead expect a Timestamp. For example:

    // Old:
    java.util.Date date = snapshot.getDate("created_at");
    // New:
    Timestamp timestamp = snapshot.getTimestamp("created_at");
    java.util.Date date = timestamp.toDate();

    Please audit all existing usages of java.util.Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.
05-06 16:12:50.323 7063-7063/com.cofoz.cofoz D/AndroidRuntime: Shutting down VM
05-06 16:12:50.402 7063-7127/com.cofoz.cofoz W/linker: /data/app/com.google.android.gms-1/lib/arm/libconscrypt_gmscore_jni.so: unused DT entry: type 0xf arg 0x194
05-06 16:12:50.405 7063-7127/com.cofoz.cofoz V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 280 native methods...
05-06 16:12:50.482 7063-7085/com.cofoz.cofoz I/art: Starting a blocking GC HeapTrim
05-06 16:12:50.484 7063-7127/com.cofoz.cofoz D/NetworkSecurityConfig: No Network Security Config specified, using platform default
05-06 16:12:50.487 7063-7127/com.cofoz.cofoz I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
05-06 16:12:51.871 7063-7080/? I/art: Debugger is no longer active
    Starting a blocking GC Instrumentation
05-06 16:12:52.128 7063-7099/? V/FA: Checking service availability
05-06 16:12:52.130 7063-7099/? V/FA: Service available
    Setting useService: true
05-06 16:12:52.132 7063-7099/? V/FA: Connecting to remote service
05-06 16:12:52.143 7063-7099/? V/FA: Connection attempt already in progress

这是我的app gradle文件。 我使用firebase作为我的后端。有时它确实给出了我的FirebaseInstanceID TOKEN RETRIVAL FAILED错误

    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"

    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    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/'] } }
    buildToolsVersion '27.0.3'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v13:27.1.1'
    implementation 'com.android.support:animated-vector-drawable:27.1.1'
    implementation 'com.android.support:mediarouter-v7:27.1.1'
    implementation 'com.android.support:support-compat:27.1.1'
    implementation 'com.android.support:support-dynamic-animation:27.1.1'
    implementation 'com.android.support:palette-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:animated-vector-drawable:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    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:15.0.1'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.github.andremion:counterfab:1.0.1'
    implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
    implementation 'com.google.firebase:firebase-auth:15.1.0'
    //implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
    implementation 'com.google.firebase:firebase-firestore:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    // Required only if Facebook login support is required
    //implementation 'com.facebook.android:facebook-android-sdk:4.27.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:15.0.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.airbnb.android:lottie:2.2.5'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    //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:15.0.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:15.0.1'
    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'
    implementation('com.github.bumptech.glide:glide:4.7.1') {
        exclude group: "com.android.support"
    }
    implementation('com.twitter.sdk.android:twitter-core:3.2.0@aar') { transitive = true }
}

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

调试器在安装后也说DEAD。 请帮帮我。

2 个答案:

答案 0 :(得分:2)

我在日志中遇到了类似的问题:

W/Firestore: (0.6.6-dev) [Firestore]: The behavior for java.util.Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
         To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:

         FirebaseFirestore firestore = FirebaseFirestore.getInstance();
         FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
             .setTimestampsInSnapshotsEnabled(true)
             .build();
         firestore.setFirestoreSettings(settings);

         With this change, timestamps stored in Cloud Firestore will be read back as com.google.firebase.Timestamp objects instead of as system java.util.Date objects. So you will also need to update code expecting a java.util.Date to instead expect a Timestamp. For example:

         // Old:
         java.util.Date date = snapshot.getDate("created_at");
         // New:
         Timestamp timestamp = snapshot.getTimestamp("created_at");
         java.util.Date date = timestamp.toDate();

         Please audit all existing usages of java.util.Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.

这听起来很奇怪,因为它建议用Timestamp替换Date数据类型,但我目前在我的数据库模型中没有任何Date(甚至Timestamp)数据类型。

我按照建议解决了它: setTimestampsInSnapshotsEnabled(true)。看起来不再支持日期类型。

答案 1 :(得分:1)

似乎应用程序在本机代码中崩溃了:

05-06 16:12:50.323 7063-7063/com.cofoz.cofoz D/AndroidRuntime: Shutting down VM
05-06 16:12:50.402 7063-7127/com.cofoz.cofoz W/linker: /data/app/com.google.android.gms-1/lib/arm/libconscrypt_gmscore_jni.so: unused DT entry: type 0xf arg 0x194

在Android Studio中打开logcat时,切换过滤器“仅显示所选应用程序”以显示所有日志行。它可能会告诉你究竟崩溃了什么。通常,使用本机代码时,会使用不兼容的库,或者库仅随ARMv7a一起提供,但您尝试在模拟器上运行应用程序(通常是X86)。

希望它有所帮助。