Am trying to send crash report from my applicatio to my domain or Mail but failed still.
To get the crash report in mail, I did
#ReportsCrashes(
formKey = "",
mailTo = "abc#gmail.com"
)
And the response is,
Sending file 1372758321000-approved.stacktrace
checkAndSendReports - finish
To get the crash report in my domain, I did
#ReportsCrashes(
formKey = "",
formUri = "http://www.abc.com/test1"
)
And the response is,
Sending file 1372856882000-approved.stacktrace
Failed to send crash report for 1372856882000-approved.stacktrace
org.acra.sender.ReportSenderException: Error while sending FORM report via Http POST
Any help will be handy for me and appreciated.
ACRA works for me sending reports by e-mail when I do exactly as they say in their docs:
#ReportsCrashes(mailTo = "reports#yourdomain.com", // my email here
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
https://github.com/ACRA/acra/wiki/Report-Destinations#sending-reports-by-email
You are probably forgetting the toast part. Or can it be you don't have an e-mail program (such as when you're running on the simulator).
I think sending reports by Google docs are not supported anymore.
Your application class should look like this.
import android.app.Application;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
#ReportsCrashes(mailTo = "user#domain.com", customReportContent = {
ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,
ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT},
mode = ReportingInteractionMode.TOAST, resToastText = R.string.crash_toast_text)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
ACRA.init(this);
}
}
No,not like Alex say,the mode property has no releation to the reporting type,you can see it in the source code in github
using the mailTo type,you should make sure that:
your app has the permission to connect network;
have an e-mail program in your device like Alex say;
have you invoked the ACRA.init(this) method in your application's oncreate()?
if all of these have done,then run your app,it will note you to configure the email,such as username and password and so on.
Related
I have just finished my first android app as part of a school project ..one of my friends encountered a problem while trying to explore one of the activities in the app ..so i searched for solutions to get the crashes reports whenever they happen to fix the bugs ..i came across ACRA ..and I followed one of SO threads to setup ACRA to my app ..
RESULT: when the crashs happens the gmail app get launch in the device and the user (if he want to) he'll send the crash report by email ..Consedering not all users will want to ..i found in a comment in one of the SO threads that some developers use tracepot.
so i have used their link for integration in formUri but exploring my account on tracepot i get nothing ..is there something i am doing wrong (or if there is a better solution than using tracepot a backend , please suggest/explain or link a good tutorial, thanks!)
MyApplication.Java ( AFTER EDITING
#ReportsCrashes(
formUri = "https://collector.tracepot.com/79b1***",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
CaocConfig.Builder.create()
//.errorActivity(CustomErrorActivity.class) //default: null (default error activity)
.apply();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
EDIT :
msg in logcat if i use the http and email:
09-17 18:37:33.700 14329-14812/ma.ac.iav.menunaviagtion:acra W/ACRA: ma.ac.iav.menunaviagtion reports will be sent by email (if accepted by user).
09-17 18:37:33.703 14329-14812/ma.ac.iav.menunaviagtion:acra I/ACRA: Sending report /data/user/0/ma.ac.iav.menunaviagtion/app_ACRA-approved/2018-09-17T18:37:33.441+01:00-IS_SILENT.stacktrace
if i use only the http :
09-17 22:47:00.648 20116-20137/ma.ac.iav.myapplication:acra E/ACRA: Failed to send crash report for /data/user/0/ma.ac.iav.myapplication/app_ACRA-approved/2018-09-17T22:44:52.199+00:00-IS_SILENT.stacktrace
IMPLEMENTATION:
compile 'ch.acra:acra:4.9.2'
LOGCAT FOR F43nd1r
09-18 01:39:49.631 18508-18803/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: ma.ac.iav.myapplication, PID: 18508
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:733)
at android.app.SharedPreferencesImpl.startLoadFromDisk(SharedPreferencesImpl.java:119)
at android.app.SharedPreferencesImpl.<init>(SharedPreferencesImpl.java:112)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:392)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:373)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.getLastCrashTimestamp(CustomActivityOnCrash.java:673)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.hasCrashedInTheLastSeconds(CustomActivityOnCrash.java:683)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.access$200(CustomActivityOnCrash.java:52)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash$1.uncaughtException(CustomActivityOnCrash.java:112)
at org.acra.builder.ReportExecutor.endApplication(ReportExecutor.java:269)
at org.acra.builder.ReportExecutor.dialogAndEnd(ReportExecutor.java:254)
at org.acra.builder.ReportExecutor.access$400(ReportExecutor.java:42)
at org.acra.builder.ReportExecutor$2.run(ReportExecutor.java:217)
By default, if the mail config is present, Acra 4 will send via mail and nothing else.
To use both you'd have to configure the reportSenderFactories.
400: Client error
Indicates that tracepot rejected your report. This could have multiple reasons. To find out what the problem is, call ACRA.DEV_LOGGING = true; right before ACRA.init and post all logcat with the ACRA tag.
Also note that ACRA 4.9.2 does not support android Oreo and above, it is recommended to upgrade to at least ACRA 4.11, or just the newest version 5.2.0.
You are not sending all required fields to Tracepot.
https://tracepot.uservoice.com/knowledgebase/articles/355272-what-are-the-required-fields-acra-needs-to-send
ANDROID_VERSION
APP_VERSION_CODE
APP_VERSION_NAME
PACKAGE_NAME
REPORT_ID
STACK_TRACE
USER_APP_START_DATE
USER_CRASH_DATE
Having read this documentation, I'm using this code...
import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;
import org.acra.ReportField;
#ReportsCrashes (
formUri = "http://example.com/crash-reports/emailer.php",
customReportContent = {ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.STACK_TRACE, ReportField.LOGCAT},
sharedPreferencesName = "ACRA_SHARED_PREFS",
sharedPreferencesMode = Context.MODE_PRIVATE
)
...to specify what content to include in my ACRA reports.
I would like to know if/how it's possible to also specify the order of this content, as the content in the emails that are sent from my emailer.php script seems to be a bit random.
The ReportBuilder class in ACRA constructs the report. It does so in a deterministic fashion and the order is determine by the code in that class.
I am trying to figure out how to add ACRA in my test project in Android Studio.
Following this article (which explains how to do it in Eclipse) https://github.com/ACRA/acra/wiki/BasicSetup, I have passed all so far up to the point where is explains to annotate your Application class with #ReportsCrashes. In this part, I dont know what to put as formUri.
I am just creating my own test app (API22 Lollipop) and trying to add ACRA support to it. I don't have any server, it is just a simple Android app.
import org.acra.*;
import org.acra.annotation.*;
#ReportsCrashes(
formKey = "", // This is required for backward compatibility but not used
formUri = "http://www.backendofyourchoice.com/reportpath"
)
public class MyApplication extends Application {
}
What do I put as the formUri?
Can you explain what formUri is for and how it works as I am new to dev?
Please explain
Thanks,
formUri points to your crash report server.
There are many to choose from, commercial and free.
The ACRA wiki lists several.
ACRAlyzer is one, but you will need to host it yourself.
Read about Acralyzer: https://github.com/ACRA/acralyzer/wiki/setup
It is simple backend for ACRA reports.
#ReportsCrashes(
formUri = "https://[your.couchdb.host]/acra-[yourappname]/_design/acra-storage/_update/report",
formUriBasicAuthLogin="[reporteruser]",
formUriBasicAuthPassword="[reporterpassword]",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
....
)
public class [YourApplication] extends Application {
#Override
public final void onCreate() {
super.onCreate();
ACRA.init(this);
}
There you will find the usage of the Acralyzer user interface: https://github.com/ACRA/acralyzer/wiki/usermanual
I am just about to release an app and I saw this stackoverflow question about things you should do before releasing an app. It tells me to use ACRA so I followed the instructions on this page.
So know I have a class called MyApplication like so :
import android.app.Application;
import org.acra.*;
import org.acra.annotation.*;
#ReportsCrashes(formKey = "", // will not be used
mailTo = "c#gmail.com",
mode = ReportingInteractionMode.TOAST,
customReportContent = { ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
resToastText = R.string.crash_report_text)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
Now apparently when my application crashes I think the user is supposed to be able to send the report somehow, so I put a null pointer in my app but it just crashes and nothing happens. Am I supposed to do anything else?
I guess you might not have registered your application on BugSense
Where you want to send the crash reporst that depands on you only. When you are using Google Docs (deprecated now), you have to use your formKey you got from your google docs document.
If you want to store the reports on your own server, you can leave the formKey field blank. The only thing you have to do is to enter a valid url to your server (formUri = ....).
The other strings are for the type of dialog, which should or shouldn't appear.
Instead of using your own server, you can use BugSense. See this thread on stackoverflow.
As the use of Google Docs is deprecated for ACRA. I recommend you to use **BugSense** as your Back-End service:
1. Go to their site and sign in: http://www.bugsense.com/
2. Create a new project to monitor in BugSense site, as a result you will receive an API Key for this application.
3. Finally add this line to you Application class in you project:
#ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=YOUR_API_KEY", formKey="")
Check out BugSense Docmentation
I am using ACRA for android app like this
#ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "issues#xyz.com",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
it is perfectly sending crash report along with Log cat. It is sending all last 200 lines of logcat with date by default.But I want to customize it to send only last 100 log cat messages of my app with log levels i or d. How to do it.
By following below link
https://github.com/ACRA/acra/wiki/AdvancedUsage#adding-logcat-eventlog-or-radiolog-extracts-to-reports
I made changes like this
#ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "issues#xyz.com",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
logcatArguments = { "-t", "100", "-v", "long","test:I" ,"*:D","*:S"},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
even though I printed some log messages with tag "test" and level "i", and manged them to print before my known crash in my app, I am getting empty logcat. I want log messages of only my app with level i or d with ACRA, how to achieve this. Thanks In Advance.
The below works for me for D level logging. My proguard strips V and I levels for production deployemnts. I am using the following code to update the log
Log.d("YOUR_TAG_HERE", "Some message here");
and the ACRA configuration is
logcatArguments = { "-t", "200", "-v", "long", "ActivityManager:I", "YOUR_TAG_HERE:D", "*:S" }
and don't forget to update your AndroidManifest.xml file adding the necessary permissions
<uses-permission android:name="android.permission.READ_LOGS" />
I was having troubles with my library project and my READ_LOGS permission was missing. I was getting random results until I added the READ_LOGS permission to the final project (not the library project).