简体   繁体   English

E / Trace:错误打开跟踪文件:没有这样的文件或目录(2)

[英]E/Trace﹕ error opening trace file: No such file or directory (2)

I recently started adding Google Analytics integration into my Application. 我最近开始将Google Analytics(分析)集成添加到我的应用程序中。 To do so I've been following the steps provided here: https://developers.google.com/analytics/devguides/collection/android/v4/ 为此,我一直遵循此处提供的步骤: https : //developers.google.com/analytics/devguides/collection/android/v4/

I had no Application class so I created one with the basic implementation provided here: http://www.javacodegeeks.com/2014/04/working-with-google-analytics-api-v4-for-android.html 我没有Application类,因此我使用此处提供的基本实现创建了一个类: http : //www.javacodegeeks.com/2014/04/working-with-google-analytics-api-v4-for-android.html

In each Activity I added the following snippets: 在每个活动中,我添加了以下片段:

@Override
protected void onStart() {
    super.onStart();
    //Get an Analytics tracker to report app starts & uncaught exceptions etc.
    GoogleAnalytics.getInstance(this).reportActivityStart(this);
}

@Override
protected void onStop() {
    super.onStop();
    //Stop the analytics tracking
    GoogleAnalytics.getInstance(this).reportActivityStop(this);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Get a Tracker (should auto-report)
    ((MyApplication) getApplication()).getTracker(MyApplication.TrackerName.APP_TRACKER);
    //...
}

and I started seeing live users on my corresponding Analytics page. 然后我开始在相应的Google Analytics(分析)页面上看到实时用户。

For whatever reason when I start the App via fresh install from Android Studio it works fine. 无论出于何种原因,当我从Android Studio通过全新安装启动应用程序时,它都可以正常运行。 However when I kill the app through the task manager and start it again it displays only a blank screen and provides the following error. 但是,当我通过任务管理器中止该应用程序并再次启动它时,它仅显示空白屏幕并提供以下错误。

E/Trace﹕ error opening trace file: No such file or directory (2)
D/ActivityThread﹕ setTargetHeapUtilization:0.25
D/ActivityThread﹕ setTargetHeapIdealFree:8388608
D/ActivityThread﹕ setTargetHeapConcurrentStart:2097152
W/dalvikvm﹕ VFY: unable to resolve virtual method 36489: Ljava/lang/ReflectiveOperationException;.printStackTrace ()V
W/dalvikvm﹕ VFY: unable to resolve virtual method 11845: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
W/dalvikvm﹕ VFY: unable to resolve virtual method 11842: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
W/dalvikvm﹕ VFY: unable to resolve virtual method 11848: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
W/dalvikvm﹕ VFY: unable to resolve virtual method 9471: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
W/dalvikvm﹕ VFY: unable to resolve virtual method 565: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
W/dalvikvm﹕ VFY: unable to resolve virtual method 587: Landroid/content/res/TypedArray;.getType (I)I

I feel like I'm missing something super basic here. 我觉得我在这里缺少一些超级基础的东西。 Can anyone point me in the right direction? 谁能指出我正确的方向?

I looked through some of the related issues on Stack Overflow and it doesn't look like any cover my current case. 我仔细研究了Stack Overflow上的一些相关问题,但看起来与我目前的情况无关。

I'm using play services version 65870000 and have the following two lines added to my manifest: 我正在使用Play服务版本65870000 ,并在清单中添加了以下两行:

<!--This meta-data tag is required to use Google Play Services.-->
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

<!-- Google Analytics Version v4 needs this value for easy tracking -->
<meta-data
    android:name="com.google.android.gms.analytics.globalConfigResource"
    android:resource="@xml/global_tracker" />

My current test device is a LG Lucid 2 (vs870) running Android 4.1.2 我当前的测试设备是运行Android 4.1.2的LG Lucid 2(vs870)

If there's any other code snippets I should include, please feel free to ask. 如果还有其他代码片段需要添加,请随时提出。

Note : I checked out my previous tag and this issue is not present so it must be related to creating this Application class, src/main/res/xml/app_tracker.xml and src/main/res/xml/global_tracker.xml config files and adding required analytics setup code in activities. 注意 :我签出了以前的标签,但是这个问题不存在,因此它必须与创建此Application类, src/main/res/xml/app_tracker.xmlsrc/main/res/xml/global_tracker.xml配置文件有关并在活动中添加所需的分析设置代码。

Thanks in advance for any help or suggestions! 在此先感谢您的帮助或建议!

Edit : If I remove the following lines from my MainActivity the app starts up properly every time again: 编辑 :如果我从MainActivity中删除了以下几行,则该应用程序每次都会再次正确启动:

// onStart
GoogleAnalytics.getInstance(this).reportActivityStart(this);
// onStop
GoogleAnalytics.getInstance(this).reportActivityStop(this);
// onCreate
((MyApplication) getApplication()).getTracker(MyApplication.TrackerName.APP_TRACKER);

Found it! 找到了! Bug in Google Analytics SDK causes an ANR when using XML for GA global configuration. 使用XML进行GA全局配置时,Google Analytics(分析)SDK中的错误会导致ANR。 AKA you can't use this Meta tag: 也就是您不能使用此元标记:

<!-- Google Analytics Version v4 needs this value for easy tracking -->
<meta-data
    android:name="com.google.android.gms.analytics.globalConfigResource"
    android:resource="@xml/global_tracker" />

See this amazing answer for more: https://stackoverflow.com/a/27542483/740474 看到这个惊人的答案以获取更多信息: https : //stackoverflow.com/a/27542483/740474

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android E / Trace(627):打开跟踪文件时出错:没有这样的文件或目录(2) - Android E/Trace(627): error opening trace file: No such file or directory (2) 打开跟踪文件时出错:没有这样的文件或目录(2),解决方案? - error opening trace file: No such file or directory (2), Solution? 打开跟踪文件时出错。 没有这样的文件或目录[2] - Error opening trace file. No such file or directory [2] Android - 错误打开跟踪文件:没有这样的文件或目录 - Android - error opening trace file: No such file or directory HttpURLConnection打开跟踪文件时出错:没有这样的文件或目录 - HttpURLConnection Error opening trace file: no such file or directory Android运行时错误:打开跟踪文件时出错:没有这样的文件或目录(2) - Android runtime error: error opening trace file: No such file or directory (2) LogCat错误打开跟踪文件时出错:没有这样的文件或目录 - LogCat error Error opening trace file: no such file or directory 是什么原因导致打开跟踪文件错误:没有这样的文件或目录? - What cause the error opening trace file: No such file or directory? Android上的JDom:打开跟踪文件时出错:没有这样的文件或目录 - JDom on Android: error opening trace file: No such file or directory 打开跟踪文件时出错:没有这样的文件或目录(2)Google日历 - error opening trace file: No such file or directory (2) Google Calendar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM