How to use Google FireBase in Android?

The Post Created(Updated) On 05/6/2022,Please note the timeliness of the article!

The purpose of my reference to Firese here is mainly to detect how many users are using the product in question, using the free version of Firebase. See the official tutorials or stuck in some places, especially when it comes to detecting success. More fortunately, the Google team is still relatively reliable, consulting related issues can give timely feedback and advice.



  • Add App

  • Download the configuration-related files according to the boot process, the operation flow is arranged quite clearly, just pay attention to the details.

  • Here on the key point, that is, the need to also configure some relevant information in the code, this is not mentioned in the tutorial, I did not add here is not any effective detection, and finally added after the good.

public class GameActivity extends AppCompatActivity {

    private FirebaseAnalytics mFirebaseAnalytics;

    protected void onCreate(@Nullable Bundle savedInstanceState) {

        // Obtain the FirebaseAnalytics instance.
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(this). mFirebaseAnalytics.getInstance(this). mFirebaseAnalytics.getInstance(this);
        Bundle bundle = new Bundle();
        bundle.putString("start", "yes");
        mFirebaseAnalytics.logEvent("share", bundle);


Firebase DebugView


  • Go to the adb directory, usually under the path of your configured SDK, e.g. windwos is
  • Enable debug mode, and replace package_name with your own application package_name.
adb shell setprop package_name
  • View the events in the Android Studio debug log.
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

  • Debugging at the same time in the Firebase corresponding APP DebugView to see if the relevant logs are received, if they can be received properly, it means that the configuration is correct. Sometimes there may be network problems and can not upload, pay attention to the logs to operate.

  • disable debug mode
adb shell setprop .none.

No data

  • Is the configuration and related code added, and is the app installed correctly on the phone or emulator?

  • If the logs are similar to the following, then it’s a network environment problem that causes upload problems.

05-06 16:58:41.419 V/FA-SVC ( 9255): Uploading data. size: 794
05-06 16:58:44.123 V/FA-SVC ( 9255): Network upload failed. will retry later. code, error: 0, Handshake failed
Handshake failed

05-06 16:55:14.770 V/FA-SVC ( 9255): Network upload failed. will retry later. code, error: 0, Unable to resolve host "": No address associated with hostname
05-06 16:55:14.792 V/FA-SVC ( 9255): Upload scheduled in approximately ms: 1800978


👇 Share This 👇


Unless otherwise noted, all work on this blog is licensed under a Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License. Reprinted with permission from -


alibaba cloud20 dollars
Vultr10 Dollars
Bandwagon HostMaybe some Coupon?
Domain | namesiloemperinter 1Dollars