ACRA / acra

Application Crash Reports for Android
https://www.acra.ch
Apache License 2.0
6.31k stars 1.14k forks source link

Cannot send logcat log by user click as attachment via Gmail or Huawei email app #600

Closed trupizzza closed 7 years ago

trupizzza commented 7 years ago

I'm trying to send logcat lines as attachment vie email while user clicks the button.

Got following lines in my AndroidManifest.xml:

           <service
            android:name="org.acra.sender.SenderService"
            android:exported="false"
            android:process=":acra"/>

           <provider
            android:name="org.acra.attachment.AcraContentProvider"
            android:authorities="${applicationId}.acra"
            android:exported="false"
            android:grantUriPermissions="true"
            android:process=":acra"/>

Here is my ReportCrashes settings:

 ReportsCrashes(
        mailTo = "foo@bar.com",
        customReportContent = {ReportField.ANDROID_VERSION,
                ReportField.LOGCAT, ReportField.STACK_TRACE},
        reportAsFile = true,
        reportSenderFactoryClasses = {EmailIntentSenderFactory.class}
)

The code in onClick() method:

  ACRA.getErrorReporter().handleSilentException(new Exception("DebugInfo"));

After user click, I see this message in the ACRA log: No email client supporting attachments found. Attachments will be ignored

If I proceed choosing mail client to send, it will put logcat lines into mail body. I'm using Huawei P8 Lite running Android 6.0 What I'm doing wrong?

F43nd1r commented 7 years ago

No email client supporting attachments found. Attachments will be ignored

This means no email client supports Intent.ACTION_SEND_MULTIPLE

Install gmail on the device and it should work

trupizzza commented 7 years ago

I have Gmail installed on my device(see topic) The problem is that I see log in the body of a letter in Gmail app instead of having it as an attachment

F43nd1r commented 7 years ago

please post your build.gradle

trupizzza commented 7 years ago

This is my app module build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.companyname.Xyz"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        versionCode 13
        versionName "2.0"

        multiDexEnabled true
    }

    applicationVariants.all { variant ->
        variant.resValue "string", "versionName", variant.versionName
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "default"
    productFlavors {
        x86 {
            dimension "default"
            ndk {
                abiFilter "x86"
            }
        }
        armv7 {
            dimension "default"
            ndk {
                abiFilter "armeabi-v7a"
            }
        }
    }
    buildToolsVersion '26.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation project(':xyz-lib')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    // Android Support
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.google.gms:google-services:3.1.1'
    // Event Bus
    compile 'org.greenrobot:eventbus:3.0.0'
    // LicensesDialog
    compile 'de.psdev.licensesdialog:licensesdialog:1.8.3'
    // Picture
    compile 'com.github.bumptech.glide:glide:4.2.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
    // Rest API
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
    // Firebase
    compile 'com.google.firebase:firebase-messaging:11.4.2'
    compile 'com.google.firebase:firebase-crash:11.4.2'
    // Masked input
    compile 'com.redmadrobot:inputmask:2.3.0'
    // QR-code scanner
    compile 'com.journeyapps:zxing-android-embedded:3.5.0'
    // RXJava
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.5'
    compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
    // Send crash logs
    compile 'com.faendir:acra:4.10.0'
}

apply plugin: 'com.google.gms.google-services'
F43nd1r commented 7 years ago

acratest-release.zip Please install this app on your device, click crash and post all logcat with the ACRA tag

trupizzza commented 7 years ago
 10-18 19:07:52.857 ? I/ACRA: Sending report /data/user/0/com.faendir.acratest/app_ACRA-approved/2017-10-18T19:07:52.715+03:00-IS_SILENT.stacktrace
 10-18 19:07:52.857 ? I/ACRA: Sending report /data/user/0/com.faendir.acratest/app_ACRA-approved/2017-10-18T19:07:52.715+03:00-IS_SILENT.stacktrace
 10-18 19:07:52.863 ? W/ACRA: No email client supporting attachments found. Attachments will be ignored
 10-18 19:07:56.429 ? W/Toast: Toast post hide failed in ThreadID[7138]:Thread[IntentService[ACRA SenderService],5,main], try hide immediate in ThreadID[7136]:Thread[Binder_3,5,main]

P.S. sorry for duplicate stuff, tried it several times

F43nd1r commented 7 years ago

Ok, that rules out an error in your app. The thing is, the same works for me on any device with gmail.

trupizzza commented 7 years ago

Sorry for open-reopen, I've missclicked :) Successfully added attachment using OnePlus 3T running Android 7.1.1 using your app. Seems like it's some sort of Huawei's EMUI "feature"

F43nd1r commented 7 years ago

Every now and then, there are devices which fail to fulfill the API contract. It's sad, but not much we can do, aside from providing the fallback to text.