I recently upgraded ACRA to version 4.5.0 and the send method in my custom ReportSender is no longer getting called.
By look at the logs, it looks like it is attempting to upload the crash report to Google Docs.
I have included some of our code below.
Custom ReportSender:
public class AcraPassportSender implements ReportSender {
...
public AcraPassportSender(int versionCode, boolean isStoreVersion){
...
}
#Override
public void send(CrashReportData report) throws ReportSenderException {
PLog.i(TAG, "Attempting to create and upload a bug report");
...
}
}
Application Class:
#ReportsCrashes(formKey="")
public class MyApp extends Application {
#Override
public void onCreate() {
ACRA.init(this);
AcraPassportSender acsender = new AcraPassportSender(version, isStoreVersion);
ACRA.getErrorReporter().setReportSender(acsender);
}
}
The logs show ACRA getting initialized. This worked before I upgraded ACRA. Any ideas of what could be happening here?
You can find the following sentence on the website of ACRA:
Since the recent update of Google Forms by Google, the usage of Google
Docs as a storage engine for ACRA reports is now deprecated.
As far as I know, Google Forms was default method of crash reporting in ACRA. You can look at ACRA project on GitHub and try to use different reporting method than Google Forms.
Moreover, I recommend you to use tools like Crashlytics, which are better than ACRA, allows you to collect crash reports and monitor your applications. Note that Crashlytics were acquired by Twitter and now they're available under fabric.io domain. You can also use paid tools like Bugsnag or create your own reporting solution.
The latest version of ACRA is 4.6.2. I would suggest upgrading to that.
GoogleFormSender was removed in 4.6.0. Other than that it is hard to know wwhat is goinf on as you have not posted the code for your Sender and you have not posted your logcat.
I suggest upgrading to 4.6.2 first and then reassessing.
Related
I am struggling to implement Google's Firebase push notifications in a mature MVVMcross application. We are being forced to seek a new solution to our current one because it appears that the functionality is about to be deprecated in AppCenter.
We've placed the code inside the RootActivity file (at the bottom of the method)
protected override void OnCreate(Bundle bundle)
When I run the app in a USB/debug scenario on my Android Galaxy I get the current error "Default FirebaseApp is not initialized in this process"
I tried to use the approach that was recommended in the error message to no avail:
FirebaseApp.InitializeApp(RootActivity.Context);
FirebaseMessaging.Instance.GetToken().AddOnCompleteListener(new OnCompleteListener());
In case anyone is wondering here is the code for the method that is mentioned above was setup for testing purposes using a breakpoint:
public class OnCompleteListener : Java.Lang.Object, IOnCompleteListener
{
public void OnComplete(Android.Gms.Tasks.Task task)
{
var token = task.Result.ToString();
}
}
We initially tested this in a standard Xamarin Forms Android app for testing and didn't have any problem with getting the token but we hit the wall when we played with it in our client's MVVMcross app.
I would also like to mention that I have tried the following solution with no luck as well:
var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(Context);
setupSingleton.EnsureInitialized();
FirebaseMessaging.Instance.GetToken().AddOnCompleteListener(new OnCompleteListener());
I found that I had two problems. The first one was the fact that my project name did not match in my manifest and google services key. I was using my own key that I setup for testing. After I realized this I switched back to my client's key and double checked that it was part of the build. As soon as I resolved that issue I found that I needed to install the nuget package for Xamarin.Google.Dagger to resolve the reflection issues. After taking care of that I did a clean/rebuild and ran the debug on my Galaxy S20 test device. This fix allowed me to hit my test break point that I setup for testing the token reception from FCM.
I'm trying to implement FB Analytics Push Campaigns on Android.
Eveything went fine with the push notifications, so I've turned my attention to the in-app notifications.
The docs' example calls for the use of a class called NotificationsManager:
public class MyGcmListenerService extends GcmListenerService {
#Override
public void onMessageReceived(String from, Bundle data) {
if (NotificationsManager.canPresentCard(data)) {
NotificationsManager.presentNotification(
this,
data,
new Intent(getApplicationContext(), MainActivity.class)
);
}
}
}
But I can't for the life of me find that class in the FB SDK, nor in the FB-Audience SDK.
I'm using v4.17.0 of the SDK. The changelog states in-app notifications were added on 4.11.0.
Wow. FB has the worst docs ever.
Apparently there is a small open source project that handles in-app notifications, and it's separated from the main SDK.
To get NotificationsManager, you need to add the following line to your gradle.build file:
compile 'com.facebook.android:notifications:1+';
Also, here is the GitHub repository for the notifications project. It contains some samples to help you with the integration.
EDIT: I've alerted FB to the issue and the support rep opened a ticket for them to update the doc.
I recently released an application for some users to use my newly made Android Application. However, they are having trouble when they perform the Facebook Login feature that I have made.
It seems to work fine on my phone, but on other phones it seems to crash. I would like to know what is causing the application to crash so I can further debug this. Is there anywhere or anything that I can use to debug this problem further?
I have looked at both the Facebook Developer Console and Google Play Developer Console and neither seem to show or point me to where my error is. If anyone could help that would be great. Thanks!
Use any Crashlytics/Analytics tools to not only get error logs but also usage statictics which can be pretty useful insight during pre-release tests. Some of them like Crashlytics by Fabric are even free and are very easy to integrate. But, there are many others too.
There are plenty of cloud hosted solutions.These might be paid, and require signing up.
If you want to roll you own simple reporting mechanism, then there is an Android library: ARCA . You can set it up to send crash reports to an email address.
First, you'll need to include the library in app's build.gradle file:
compile 'ch.acra:acra:4.9.0'
Then declare extent the Application class (or modify if you already have) as :
import org.acra.*;
import org.acra.annotation.*;
#ReportsCrashes(mailTo = "reports#yourdomain.com",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class MyApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
The two thing necessary are:
Add #ReportsCrashes annotation to app's application class, with recipient mail address.
Override attachBaseContext() and include ACRA.init() in it.
Official docs:
Setting up ARCA.
Advanced configuration.
In Android, is there a way to tell why app crashed on my device? Let's say I have root access to the device, but the app that crashed is not debuggable and does not print anything to logcat.
Just to reiterate, the app that crashed is not my app, I have no access to the source, and it's not debuggable (it's a release build). I just want to get any available insights on why it crashed.
EDIT: I forgot to mention, I only found the /data/anr/ and /data/tombstones as sources for potential information. Those do not contain the stacktraces. Is there anything more available?
EDIT: There is a lot of confusion in comments, please read the question carefully. What I'm after is some kind of low level component that knows about the reason of the crash. The virtual machine must know, right?
I identified following sources that may or may not have useful information about 3rd party apps crashes:
adb logcat -b crash
/data/tombstones/
/data/anr/
Cannot. In third-party app, you cannot get detail about crash report. In some rarely case, third-party application has saved crash reports to log file. If you know file location, you can analyze crash on that log file. Otherwise, there isn't any way.
In case you develop your own app, and your application already has released to user and you want to get some statistic about crash event. You can gain some insight by using Crash Report Service as I mention below.
In case you want go get crash report from your own application, here is some libraries and services for your: ACRA library. Crash report will generated and post to Google Form. Really easy to use and setup in your application. As document stated:
#ReportsCrashes(formUri = "http://www.yourselectedbackend.com/reportpath")
public class MyApplication extends Application {
#Override
public void onCreate() {
// The following line triggers the initialization of ACRA
super.onCreate();
ACRA.init(this);
}
}
But you must have your own server. (There are tutorials for deploying this server, but you still must have your own). If you want to depend all to third-party service then Crashlytics or Crittercism or Countly or Google search query
I need to send the bug report into GoogleDocs CrashReports-Template.
But I am not getting a single error.
#ReportsCrashes(formKey = "dfbhkdfjbnkjsdnkjsdfn")
public class MainActivity extends Application
{
#Override
public void onCreate()
{
super.onCreate();
ACRA.init(this);
}
}
any suggestion?
where am I wrong?
I think you should not use GoogleForms, because developers of ACRA strongly not recommend this. You can read more here https://github.com/ACRA/acra/wiki/Notice-on-Google-Form-Spreadsheet-usage and also note on this:
Unfortunately, we have been asked by Google to stop making our users
automatically post data to Google Forms just before the 'refresh' of
this great tool published a few months ago. The current
GoogleFormSender is working only on 'Legacy Forms'which can't be
created anymore in Google Drive.
So, I think will better to change your reports transporting into other destination:
https://github.com/ACRA/acra/wiki/AdvancedUsage#reports-destination
Sending crash reports to Google Docs isn't supported anymore. Google wasn't happy about this usage. You can find the alternatives in the documentation.