From Firebase docs they say:
Multiple processes
Crash Reporting creates a separate background process to upload crash info. If your app extends the Android Application class, you must ensure it is multi-process safe. Otherwise, it may cause concurrency issues. When an app extends an Application object, this object gets instantiated for each process in a multi-process app. Two important things to watch for are:
If the implementation of this object accesses any out-of-process state (a database, the file system, shared preferences, etc), or performs other actions not safe for a multi-process environment, concurrency issues might arise. This is because multiple instances of the Application object may run simultaneously. Many third-party libraries keep out-of-process state (e.g. in a local database) and are subject to the same concurrency issues if they are initialized from the Application object. If your app fits the description above and you plan to use Crash Reporting in your app, we strongly encourage you to consider moving the Application logic to Content Providers, or to Android Activities. Any Application logic that is not safe for a multi-process environment can have unintended effects on your app.
How can I check from my Application
class if theres another instance inside the Application
onCreate
to avoid crashes with Fabric
or others?
Generally speaking, you don't "check to see" if there is another Application object from another process. You simply assume that there is always exactly one Application object created for every process in your app, and ensure for yourself that it will be safe to run in conjunction with other Applications objects in other processes. Just don't access any shared read/write resources from Application and you will be fine.
If you must initialize something from only the main process, a more reliable way of doing this is to create a ContentProvider (declare in your manifest and create an object for it like any other component), and use its onCreate(). ContentProviders are only created and initialized from the main process - never from other processes. This way you can be sure that your init will not be duplicated in any other process.
Or if you don't want to deal with this at all, just wait until Crash Reporting comes out of beta to full release, as it will not use an extra process at that time in the future. We (Google) can't say exactly when that will be, but we're not wasting any time in getting the full release published.