95

I linked my Android app with Firebase using Android Studio Which created and set my google-service.json into my project.

When i debug my event logging in logcat i got :

V/FA-SVC: Successful upload. Got network response. code, size: 204, 0

But nothing is showing into firebase console debug view

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
mvand
  • 993
  • 1
  • 6
  • 6
  • 2
    You need to enable it for you app: `adb shell setprop debug.firebase.analytics.app ***package_name***` – Michael Sotnikov Mar 14 '17 at 12:04
  • 5
    I did it. I also activate additional logging which provide the line i mentionned. – mvand Mar 14 '17 at 14:22
  • 2
    have you found any reason?? 1. enabled adb debug 2. saw in log also but not in debug view – Lokesh Tiwari Oct 23 '17 at 12:53
  • 1
    `V/FA-SVC: Successful upload. Got network response. code, size: 204, 0`; Firebase says My app is connected on first use. But still can't see Debug Events; I did **adb shell setprop** on app package; also matched **gmp_app_id: 1:8427#####:android:7dd#########** in json file. Am on Spark plan! @LokeshTiwari – Johnny May 06 '18 at 18:23
  • 13
    Also doesn't work for me - did everything as per the documentation. DebugView always says "No devices available" in the top left selector. – ubuntudroid May 16 '18 at 15:37
  • For me, firebase debuging works for debug build of the app, but it doesn't work for the release build. I didn't find any documentation about that. Is this case with anyone else? – NixSam Apr 13 '20 at 07:02
  • 8
    For me it was the following sequence 'reboot device, uninstall & install the app' then device appeared in DebugView. – Anton Oct 25 '20 at 12:15
  • you probably need to enable the debug mode using this: https://firebase.google.com/docs/analytics/debugview#enabling_debug_mode TLDR; 1. to enable debug mode: ```adb shell setprop debug.firebase.analytics.app package_name``` (get the package name from your AndroidManifest.xml file, i.e. the value of ```package```) 2. to disable it (when you're done): ```adb shell setprop debug.firebase.analytics.app .none.``` – Amin Dannak Feb 27 '21 at 09:48
  • Thanks @Anton a fresh install was what it took for me – jack Apr 26 '22 at 17:00
  • should application be in debug mode?? – Nininea Oct 28 '22 at 09:47
  • Started randomly working after rebooting emulator, force closing the app, restarting android studio etc. It's a bit glitchy it seems. – beetree May 06 '23 at 15:05

25 Answers25

103

Test device setup

To enable sending of DebugView data on a connected Android test device for a configured Firebase Analytics app, you can follow the step below:

  1. If you are simply working with single build variant, the following command is enough:

    adb shell setprop debug.firebase.analytics.app [your_app_package_name]
    
  2. But if you are working with multiple build variants with different application IDs which are not the same as the app package name, be sure to execute the following command:

    adb shell setprop debug.firebase.analytics.app [your_application_id]
    

    Here, application ID is the app ID of your build variant found in the corresponding gradle file. For example, lets say you have x.gradle and y.gradle for two build variants x and y, and you also have the general build.gradle file. To debug the build variant x with application ID com.abc.x, the command will be:

    adb shell setprop debug.firebase.analytics.app com.abc.x
    

    Similarly, to debug the build variant y with application ID com.abc.y, the command will be:

    adb shell setprop debug.firebase.analytics.app com.abc.y
    

This behavior persists until you explicitly disable it by executing the following command:

adb shell setprop debug.firebase.analytics.app .none.
M. Arabi Hasan Sakib
  • 2,626
  • 2
  • 13
  • 20
Diptendu Das
  • 3,990
  • 7
  • 22
  • 38
  • 4
    If you have more than one emulator running, you have to use `adb -s SERIAL` (SERIAL for the unique id of the emulator). If one device and one emulator are connected you can use shortcuts: `adb -d ...` for device and `adb -e ...` for emulator. – friederbluemle Jul 18 '18 at 04:03
  • 1
    I have the app installed and simulator is in debug mode any other prerequisite required to see the data in firebase? The app is a React Native android app and for react native iOS app all data are tracked from real devices. – Saif Siddiqui May 30 '19 at 09:18
  • 1
    it says no device attached in firebase console debug view. – Rhn Bhadani Jul 16 '19 at 10:29
  • 4
    How to add another test device? The other device is not with me. It's with the testing team. They do not have Android studio installed. Please help. I am able to see debug events that are triggered from my phone. Unable to see events triggered from other phones – Vijai Gunasekar Oct 08 '20 at 09:22
  • my problem is multiple build variants ,how do i know my [your_application_id] ? – nikeru8 Aug 05 '22 at 11:30
  • Was anyone able to find the solution to the problem mentioned by @VijaiGunasekar I'm looking for the solution for the same issue. – AkshayDoshi Feb 20 '23 at 13:31
46
  1. Run your app in debug mode
  2. Goto Developer Options -> Select debug app -> Select

You will see your device listed in Firebase DebugView

anurag_dake
  • 988
  • 13
  • 15
  • 1
    Do we have to do this every time Android Studio does a full rebuild? Given the app gets deleted and reinstalled – giorgio79 Aug 29 '21 at 17:29
  • I think this is the correct answer as it will confirm the full application name including the varients that you are currently running – ant2009 Oct 11 '21 at 10:32
  • 3
    This helped. Such a shame that it is not present in the official documentation. – Michał Dobi Dobrzański Mar 14 '22 at 11:08
  • 4
    Where's the `Developer Options`? – iDecode Mar 31 '23 at 08:24
  • `Developer Options` can be found on your device. It is under `Settings/System/(advanced)`, but only if you have enabled developer mode. To enable developer mode, Go to `Settings/About phone` and tap seven times on the build number. It should give a confirmation toast. – Roland van der Linden Aug 23 '23 at 12:10
35

After performing steps from Enabling debug mode, make sure that date and time on your debug device or emulator and on your PC is correct.

If after correcting the date and time events are still not showing on DebugView, clear the app storage. Then restart the app and try again.

cubuspl42
  • 7,833
  • 4
  • 41
  • 65
Ashraf Atef
  • 401
  • 4
  • 9
27

Enabling debug logging is different from enabling debug mode. As Frank van Puffelen suggested in his comment, to enable debug mode you need to set "debug.firebase.analytics.app" property to your app package name.

You can do this using adb with the following command:

adb shell setprop debug.firebase.analytics.app "your.app.package.name"

You can find the package name of your app inside your AndroidManifest.xml as the package attribute on the manifest element (first element in the xml document).

Community
  • 1
  • 1
djabi
  • 5,601
  • 18
  • 25
  • 2
    Package name should be defined in gradle file ;) – mrroboaat Sep 26 '17 at 10:05
  • 1
    how will I do that for ios – Nabeel K Mar 14 '18 at 10:34
  • 1
    Do you execute the adb command on the android device/emulator, or in the development machine's terminal? If the latter, how does it know which emulator to affect, or does it do all of them? – CodeGrue May 13 '18 at 19:17
  • 1
    To answer my own question, you enter it on the development machines terminal. However, the quotes around packagename was the issue. It worked for me with no quotes. – CodeGrue May 15 '18 at 22:03
  • Also make sure you have the right package name. My debug package name was different because I was using build variants and hence .dev was added to my debug build – saintjab Sep 12 '18 at 13:26
20

In my case, even running the adb shell setprop debug.firebase.analytics.app "your.app.package.name" didn't help. While I was hopelessly trying to find something, I decided to check the firebase plugin for Android Studio for something related and found out under the section for analytics that the following commands are needed for verbose logging:

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

I thought that it might be helpful at least to see if the app is sending out some tracking information to the servers at all and run those commands. For my big surprise, it helped also the DebugView and I was then able to see my device.

Mehmed Mert
  • 935
  • 1
  • 7
  • 24
  • 1
    Thanks. This works for me Unity 2020.3.20f1 os windows. Also I found the best video about these commands https://www.youtube.com/watch?v=JDxXiarsrHk – dev-siberia Oct 17 '21 at 13:30
  • 1
    Thank you. It helps a lot! Next time I have a problem with analytics I will check for this. It should be written in the docs. – leb1755 Dec 02 '21 at 08:33
14

Delete the App on the device/emulator first!

From the terminal run:

adb shell setprop debug.firebase.analytics.app [your_app_package_name]

Then rebuild/debug the app on your device/emulator.

Finally your debug data will show up in Firebase > Analytics > DebugView

People have said "erase content and settings" and "clear the app storage"...etc, but I didn't get it and have spent hours trying to get this working. All you need to do to clear this out is delete the app from your device. Debug won't work unless all the app data is cleared out.

If you are looking for your_app_package_name, its in your AndroidManifest.xml file under package.

UPDATE 2023: If you are looking for your_app_package_name, it now could be in your build.gradle file under applicationId.

FinestStudios
  • 181
  • 1
  • 7
10

Also make sure that you have the latest Google Play Services installed in the device/emulator or nothing is guaranteed to work.

If you go to the settings on your emulator, there is Update button for that. Unfortunately it requires you to sign-in via your Google account.

enter image description here

tasomaniac
  • 10,234
  • 6
  • 52
  • 84
5

As others have mentioned, I think commonly the issue here is using the wrong package name. I had this problem with an app I recently started collaborating on, and using the package attribute from AndroidManifest.xml wasn't working. I suspected that the build was appending something to the package name but couldn't find the place where this was defined. The simplest way I found to discover the actual package name was to launch "Attach debugger to Android process" in the top bar on Android Studio, which then shows a list of processes with their associated package names on the AVD. Sure enough, using the correctly-appended package name taken from this list did then cause Firebase Analytics Debug View to wake up.

user155631
  • 85
  • 2
  • 9
5

Disable any ad-blocking mechanism in your debugging device. This was the problem here. I had AdAway enabled.

I know the question is old, however it may help someone.

Daniel
  • 708
  • 1
  • 8
  • 18
5

For me the problem was using "package name" in the adb command as they suggest in the docs. But whay you must use is the applicationId of your build. Though they are the same a lot of times they can be different if you specify another appId in build.gradle file or add postfixes for some specific build variants.

I don't know why they always use the "package name" words for it, since it just means the way we organize our code.

A. Kazarovets
  • 1,607
  • 1
  • 12
  • 10
1

I had problems with events and devices not showing up in the Firebase Debug View.

Found out that my pi-hole on my network was eating all the events. So if if you have any kind of ad blocker on your network, disable it and try again.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Tristan Richard
  • 3,385
  • 1
  • 15
  • 17
1

After reading the comment here, I found it helpful to run the following commands from a terminal:

adb kill-server
adb start-server
adb shell setprop debug.firebase.analytics.app package_name

Then I was able to select my emulator from the Firebase debug device list and see Firebase events from an app running in Android Studio Bumblebee | 2021.1.1 Beta 1

1

In my case, I did two things:

Firstly

I add the following command in android studio Terminal

adb shell setprop debug.firebase.analytics.app [your_application_id]

Secondly:

I went to the Developer Options on my phyiscal device, and i clicked "Select debug app", then i chose my app.

then my device appeared on Debug View devices.

1

After trying every potential solution on the internet, and none of them working. These are the steps I used to finally enable DebugView to find my device:

  1. Close the app on the device you’re working on

  2. Go to the Firebase console and sign out of your account

  3. Sign back in again, go to the console and select the project you’re working on.

  4. Again, not sure if this made a difference however do NOT click on DebugView item under the “Project shortcuts” list. Instead, click on the “Analytics” drop-down and select DebugView from there.

It may be possible that this process updates the data stream used in the DebugView page - after following these steps I noticed events which had been missed initially were now showing up - almost as if the event was sent/received properly however the DebugView wasn’t showing the correct data stream.

Bonus tip:

Had issues with this again today, and after signing out/in to Firebase the DebugView still wasn't finding my device. What fixed it was, on my device, move the app into the background i.e. swipe up from the bottom to go to the home screen...

When you re-open the app into the foreground, the DebugView should now start displaying events. I imagine this works because the action of moving the app into the background I believe triggers any saved events on the device to be sent to Firebase, essentially flushing the queue.

GETEM5
  • 37
  • 1
  • 6
0

I configured everything correctly and had an emulator and a device running. The emulator events showed up, but the device didn't. 2 hours later I figured out that there is a device-selector in the DebugView and selecting the device was showing the events all the time:

enter image description here

Stuck
  • 11,225
  • 11
  • 59
  • 104
0

If you are on iOS simulator. Try this:

Step1 : "Erase All content and settings" on simulator and let the simulator start again

Step2 : start your app

Step3 : Close the firebase debug tab and start again.

The debug logs were not coming for me and after doing this I am successfully getting the logs.

Note : The above thing happened atleast 7/8 times from past few days.

user18853
  • 2,771
  • 1
  • 21
  • 17
0

First of all check if your bebugging device is connected to the internet, because without an active internet connection Firebase will of course not receive any debugging data.

Secondly, your debugging device may be showing multiple times on Firebase Analytics Debug View, like mine was.

Strangely enough, you'll have to select the correct item corresponding to your currently running device so that you can see the live logs. It looks like Google keeps your device listed from previous debugging sessions, rather than replacing the session with the current one, which in my opinion would be the right approach to follow.

enter image description here

Ulysses Alves
  • 2,297
  • 3
  • 24
  • 34
0

I'm not sure if you have received your answer or not, but one thing that got me snagged up was all the directions say to do, is enter this command and use your package name. BUT, if you are using flavors and adding package suffixes then you must make sure you have that in the shell command as well.

If you have a dev / uat / prod variant/flavor combo , make sure that you are adding the suffix if you have one. In my instance I have a '.dev' suffix, so my command looks as follows:

adb shell setprop debug.firebase.analytics.app com.myapp.something.dev
Jarrett R
  • 81
  • 5
0

Firstly, You should delete the App on the device or emulator.

I faced a similar situation. I ran the following command on Windows device

adb shell setprop debug.firebase.analytics.app "app_package_name"

You can find out from AndroidManifest.xml file.

enter image description here

It's worked.

Halil Ozel
  • 2,482
  • 3
  • 17
  • 32
0

If everything is properly set up and still Debug View is not working

I face this issue even though I have enabled the Debug view via command and cross-checked with some other device & system which works properly. But somehow it was not working on my emulator. This might also happen on a real device.

Solution for not working only on a specific device or emulator in the system:

To see the logs & events in Debug View. We need to make sure that the emulator or device Date & Time with Timezone are set to our local time which should be also the same in the analytics console. After making same date and time I was able to see the logs & event in Debug View.

enter image description here

I hope this might help those who have followed all the things correctly but missed this case.

Patel Pinkal
  • 8,984
  • 4
  • 28
  • 50
0

Enable Firebase debug mode

Use this command to enable firebase debug mode on your device.

adb shell setprop debug.firebase.analytics.app yourappid

Use the following command to check the app id (package name) if you are not sure.

aapt dump badging path-to-your-apk

for example: aapt dump badging c:\myapp.apk

Check google_app_id correctness

And make make sure your app is using the expected google app id especially when the app has variants.

You can use apktool to un-package your apk, and find the google_app_id in /res/values/strings which should be the same as the app id in the firebase project setting.

If the google_app_id of your apk is not expected, you may need to check if it's using the right google-services.json.

Clean your project and rebuild, if everything look good.

Find google_app_id in your apk enter image description here enter image description here

situee
  • 2,710
  • 2
  • 22
  • 27
0

I'm having the same issue. DebugView works fine with emulator, but distributed app isn't getting picked up. I've checked the schemas and they include the flag:

         <CommandLineArgument
        argument = "-FIRDebugEnabled"
        isEnabled = "YES">

Any ideas how to make it work on distributed app? I'm using AppCenter just in case.

alex.mironov
  • 2,834
  • 6
  • 27
  • 41
0

Thanks GETEM5 for idea. I have tried everything possible, but no result. After moving the application to the background, the application disconnected from the debugger, it unloaded, launched it again from the application icon and the device appeared in DebugView in realtime...but can help just moving to the background for sending i think.

-1

In my case, I replaced previous google-services.json file with new one. For this case, I needed to remove the "build" folder, rebuild the project, did debug run on device also followed other steps like, adb shell setprop debug.firebase.analytics.app "your.app.package.name" too. Then it worked.

-1

install the required NDK version for your project. Version 21.0.6113669 worked for me

see this image for details installation