How to track errors when distributing Android Application to Alpha Testers? - android

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.

Related

Firebase push notification - Default FirebaseApp is not initialized in this process

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.

How to run AppsFlyer SDK Integration Test for a Unity project?

I'm working with AppsFlyer in Unity based on the following documentation: https://support.appsflyer.com/hc/en-us/articles/213766183-Unity-plugin-V4-integration-guide-for-developers
I followed the necessary steps but when it came to running the integration test, it just stayed stuck in this screen:
https://imgur.com/a/taXW909
Are there any potential things that I might be missing that could cause this issue? As far as I understand, I need to whitelist my Android device, select it in the SDK Integration Test, scan the QR Code, install my project's .apk file and the AppsFlyer should start detecting something.
Additional details
Here's the script for initializing AppsFlyer:
public class AppsFlyerObject : MonoBehaviour
{
private const string AppsFlyerKey = /* MY DEV KEY */;
private void Start()
{
AppsFlyer.setAppsFlyerKey(AppsFlyerKey);
AppsFlyer.init(AppsFlyerKey, "AppsFlyerTrackerCallbacks");
}
}
Regarding the AppsFlyer app, here're the settings I selected:
https://imgur.com/a/7PxEnlW
I want to test an APK file that is not present on any kind of a store.
Have you tried testing a non-organic install with this link?
https://support.appsflyer.com/hc/en-us/articles/207032126#integration-43-simulating-a-nonorganic-install
If everything implemented correctly, but you are still stuck on this screen - it's very likely you have 'zero plan' on your AppsFlyer account. You cannot pass this test on free plan for some reason.
I've found it after two days by connecting device via logcat and recieving 403 error. You can do same to be sure its your reason too.

How to learn a reason why a 3rd party, non-debuggable app crashed

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

stuck to when get ACRA bug report?

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.

Disable GoogleAnalytics from Android App when testing or developing

I'm using EasyTracker in my Android App and I need a way to disable Analytics tracking when the app is in "development" or "testing" mode (I have a flag in a constants file to discriminate).
What's the best way to do so?
Thanks!
I believe the correct way to do this with Version 4 of Analytics is with the Opt Out method
GoogleAnalytics.getInstance(this).setAppOptOut(true);
You could set that method to be set if you build in debug mode. ie.
GoogleAnalytics.getInstance(this).setAppOptOut(BuildConfig.DEBUG);
I am using something similiar to allow users to opt-out of analytics.
I found this information at he following link: https://developers.google.com/analytics/devguides/collection/android/v4/advanced
Edit: Just saw the date of the original question, but thought I would add this answer anyway as it was something I was looking for.
UPDATE: With release of Google Analytics v3 for Android,
The SDK provides a dryRun flag that when set, prevents any data from
being sent to Google Analytics. The dryRun flag should be set whenever
you are testing or debugging an implementation and do not want test
data to appear in your Google Analytics reports.
To set the dry run flag:
// When dry run is set, hits will not be dispatched, but will still be
logged as though they were dispatched.
GoogeAnalytics.getInstance(this).setDryRun(true);
+++ My old answer +++
Just comment the following line in your analytics.xml file while you are in development mode.
<string name="ga_trackingId">UA-****</string>
Google Analytics wouldn't be able to find any tracking id, so EasyTracker won't be able to do its job.
When you are building the app for release, uncomment the line and you're good to go.
If you are building a standalone app(not a library), this will be the easiest way to do it, let the build system figure out if it is a debug build or not.
if(BuildConfig.DEBUG){
GoogleAnalytics.getInstance(this).setDryRun(true);
}
I see on the web that this method does not work well for library projects as there is bug in the build tools which does not set the BuildConfig.DEBUG flag correctly for libraries. Not sure if this issue is fixed now.
You can use a class with a static boolean value let's say DEBUG like this :
public final class BuildMode {
public final static boolean DEBUG = true;
}
In code, just use :
if (BuildMode.DEBUG) ...
This is a solution working on all android SDK versions!
Newest version from firebase has this method that can be put inside App class:
FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(!BuildConfig.DEBUG);
What I'm doing is disabling periodic dispatching, by setting a negative period, in analytics.xml:
<integer name="ga_dispatchPeriod">-60</integer>
or you can do it programmatically, using your flag:
if (testingMode) {
GAServiceManager.getInstance().setDispatchPeriod(-1);
} else {
GAServiceManager.getInstance().setDispatchPeriod(60);
}
That way hits are not sent unless you do it manually.
That should work if you are using only periodic dispatching (never calling .dispatch() manually). Hits not sent before 4 a.m. of the following day are somehow discarded, I guess, as they are not appearing in the reports anyway.
See in Google Analytics Developer Guide:
Note: Data must be dispatched and received by 4 a.m. of the following day,
in the local timezone of each profile. Any data received later
than that will not appear in reports.
More info: https://developers.google.com/analytics/devguides/collection/android/v2/dispatch
My technique is to change the android:versionName in Android Manifest until release time.
For example, 1.0.0.ALPHA until time to build a release APK, at which point you could change to 1.0.0. This way you can still see all of your crash reports later, but they will grouped in analytics.
This SO ticket talks about using the BuildConfig.DEBUG flag to conditionally configure analytics and Atul Goyal's answer references the dryRun flag in v3. Those two things could be a nice setup if you don't care about seeing crash reports during debug in the future, and assuming that the BuildConfig.DEBUG flag works correctly.
I have a different approach to this issue. Sometimes you still want to test that analytics is working correctly, but want to just filter test data out in production reports. My solution to that is to create a custom session-scoped dimension (i.e. AppBuild), in GA for the property which tracks if you are running a debug or production build of the app. In your code after you create the Tracker, put:
// replace 1 with the correct dimension number if you have other dimensions defined
tracker.set("&cd1", BuildConfig.DEBUG ? "debug" : "production");
Then create or modify your GA view to add a filter on AppBuild, excluding debug. This should filter out all debug data from your GA view. You can also add a new view to show debug data.

Categories

Resources