DebugView没有可用的设备 [英] DebugView no devices available
问题描述
我正在一个小型应用程序上进行一些测试,以了解firebase-analytics的工作方式.这是MainActivity的代码:
I'm doing some tests on a small app to understand how firebase-analytics works. This is the code for the MainActivity:
public class MainActivity extends AppCompatActivity {
private FirebaseAnalytics mFirebaseAnalytics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());
mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
mFirebaseAnalytics.setMinimumSessionDuration(10000);
mFirebaseAnalytics.setSessionTimeoutDuration(300);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,"ID");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME,"NAME");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE,"image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
}
要查看我的应用程序是否将数据发送到Firebase,我尝试使用DebugView,但它说没有可用的设备,我还使用了命令
To see if my app send data to Firebase I tryed to use DebugView but it says that there isn't any devices available, i also used the command
adb shell setprop debug.firebase.analytics.app <package_name>
但没有任何变化.
如果我使用这3条命令
but nothing changed.
If i use these 3 commands
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
我可以看到我的应用正在向Firebase发送一些数据,例如这张图片
i can see that my app is sending some data to firebase, like in this picture
我该怎么做才能启用DebugView并实时查看我的应用发送到Firebase的内容?
What can i do to enable DebugView and see what my app send to firebase in real time?
推荐答案
请确保已遵循以下步骤:
Please ensure that the following steps have been followed:
步骤1::您的应用已在Firebase控制台中正确配置为支持Google Analytics(分析)功能.
Step 1: Your app is properly configured in the Firebase console to support the Analytics features.
第2步:
A)如果您仅使用单个构建变体,则以下命令就足够了:
A) 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]
B)但是,如果您正在使用具有与应用程序包名称不同的不同应用程序ID的多个构建变体,请确保执行以下命令:
B) 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]
在这里,应用程序ID是在相应的gradle文件中找到的构建变体的应用程序ID.例如,假设您有两个构建变体x和y的x.gradle和y.gradle,并且还具有常规的build.gradle文件.要使用应用程序ID com.abc.x调试构建版本x,命令将为:
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
类似地,要调试应用程序ID为com.abc.y的构建版本y,命令将为:
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.
这篇关于DebugView没有可用的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!