gpt4 book ai didi

android - TagManagerService 出现 ANR

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:30:17 25 4
gpt4 key购买 nike

我遇到了一个我无法弄清楚的问题。当我在第一个 Activity 屏幕上按 backPress 键转到主窗口时,会出现此 ANR。按下后,我尝试返回应用程序,出现白屏,然后是黑屏。一两分钟后,ANR 消息弹出窗口出现。

那是我的 gradle play-services 相关

def googlePlayServicesVersion = '9.0.2'


compile "com.google.android.gms:play-services:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-vision:$googlePlayServicesVersion"

Starting window AppWindowToken{44f94e90 token=Token{42a85dc8 ActivityRecord{430f4b70 u0 com.ioa***.****/com.******.****.activity.SignUpInTabActivity_ t84}}} timed out

ANR in com.ioa***.****
PID: 24075
Reason: Executing service com.ioacom.ioa***.****/com.google.android.gms.tagmanager.TagManagerService
Load: 4.49 / 4.91 / 5.12
CPU usage from 5972ms to 0ms ago:
1.3% 372/adbd: 0.1% user + 1.1% kernel / faults: 406 minor
1.1% 953/system_server: 0.6% user + 0.5% kernel / faults: 6 minor
0.1% 1//init: 0% user + 0.1% kernel / faults: 52 minor
0.3% 1053/com.android.systemui: 0.3% user + 0% kernel / faults: 2 minor
0.3% 18921/kworker/0:2: 0% user + 0.3% kernel
0.1% 3/ksoftirqd/0: 0% user + 0.1% kernel
0.1% 8/rcu_preempt: 0% user + 0.1% kernel
0.1% 144/mmcqd/0: 0% user + 0.1% kernel
0% 204/servicemanager: 0% user + 0% kernel
0% 224/mediaserver: 0% user + 0% kernel
0% 1097/wpa_supplicant: 0% user + 0% kernel
0.1% 1749/mpdecision: 0.1% user + 0% kernel
0% 17052/kworker/u8:7: 0% user + 0% kernel
0% 20159/kworker/0:3: 0% user + 0% kernel
0% 24075/com.ioa***.******: 0% user + 0% kernel
9.3% TOTAL: 2.8% user + 6.2% kernel + 0.1% iowait
CPU usage from 2824ms to 3341ms later:
3.8% 953/system_server: 0% user + 3.8% kernel / faults: 1 minor
3.8% 967/ActivityManager: 0% user + 3.8% kernel
9% TOTAL: 0% user + 0% kernel + 9% iowait

My Launcher Activity 应该在用户第一次进入应用时出现:

public class FirstActivity extends AppCompatActivity {

public void onCreate() {
if (userDataAccess.getUserProfile() != null) {
startDashBoardActivity();
finish();
} else if (!preferences.isFirstAccess().get()) {
startLoginActivity();
}
}

}

我的登录 Activity :

@EActivity(R.layout.activity_with_tabs_layout)
public class SignUpInTabActivity extends AppCompatActivity {

@ViewById(R.id.toolbar)
Toolbar toolbar;

@ViewById(R.id.tabs)
TabLayout tabLayout;

@ViewById(R.id.viewpager)
ViewPager viewPager;

private LoginFragment loginFragment;

@AfterViews
public void init(){
setSupportActionBar(toolbar);
ViewCompat.setElevation(tabLayout, 4);
if(getSupportActionBar() != null) {
toolbar.setSubtitleTextColor(ContextCompat.getColor(this, android.R.color.white));
toolbar.setTitleTextColor(ContextCompat.getColor(this, android.R.color.white));
toolbar.setTitle(R.string.*****);
toolbar.setSubtitle(R.string.flavor);
}
setupViewPager();
}

@UiThread
public void setupViewPager() {
loginFragment = LoginFragment_.builder().build();
ViewPagerTabsAdapter adapter = new ViewPagerTabsAdapter(getSupportFragmentManager());
adapter.addFragment(loginFragment, getString(R.string.login).toUpperCase());
adapter.addFragment(SignUpFragment_.builder().build(), getString(R.string.register_user).toUpperCase());
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
loginFragment.onActivityResult(requestCode,resultCode,data);
}

}

最佳答案

这似乎是 play-services 9+ 的问题。

我的第一个解决方法是将播放服务回滚到 8.4.0,然后一切都恢复正常。

我一直在寻找解决方案,因为以上都不满足我,而

我发现问题出在特定的“通用播放服务”上,我不明白为什么它适用于 8.4.0 而不是 9+。

我的解决方案是删除下面的行

compile "com.google.android.gms:play-services:9.0.2"

只保留具体的(这是最好的方法,不管所讨论的问题是什么)

compile "com.google.android.gms:play-services-analytics:9.0.2"
compile "com.google.android.gms:play-services-auth:9.0.2"
compile "com.google.android.gms:play-services-vision:9.0.2"

而且有效!

我真的很想知道为什么错误是 ANR。

关于android - TagManagerService 出现 ANR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37859877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com