gpt4 book ai didi

android - 为什么我收到此服务错误?

转载 作者:行者123 更新时间:2023-11-29 14:52:06 27 4
gpt4 key购买 nike

为什么我调用服务时出现这个错误

E/ActivityManager(160): ANR in com.colo
E/ActivityManager(160): Reason: Executing service com.colo/.services.PmService
E/ActivityManager(160): Load: 8.41 / 7.12 / 6.4
E/ActivityManager(160): CPU usage from 21836ms to -1ms ago:
E/ActivityManager(160): 2.2% 160/system_server: 1.3% user + 0.9% kernel / faults: 9 minor
E/ActivityManager(160): 1.9% 65/bma_wq: 0% user + 1.9% kernel
E/ActivityManager(160): 1.4% 28646/com.colors.pipemedia: 1.2% user + 0.1% kernel / faults: 285 minor 1 major
E/ActivityManager(160): 0.5% 27859/com.google.android.apps.maps:NetworkLocationService: 0.4%
user + 0% kernel / faults: 280 minor 14 major
E/ActivityManager(160): 0.3% 18292/com.android.systemui: 0.3% user + 0% kernel / faults: 48 minor
E/ActivityManager(160): 0% 61/synaptics_wq: 0% user + 0% kernel
E/ActivityManager(160): 0.1% 144/adbd: 0% user + 0.1% kernel
E/ActivityManager(160): 0.1% 246/com.android.phone: 0.1% user + 0% kernel / faults: 1 minor
E/ActivityManager(160): 0% 62/check_ic_wq: 0% user + 0% kernel
E/ActivityManager(160): 0% 72/kondemand/0: 0% user + 0% kernel
E/ActivityManager(160): 0% 28602/logcat: 0% user + 0% kernel
E/ActivityManager(160): 0% 5/events/0: 0% user + 0% kernel
E/ActivityManager(160): 0% 58/file-storage: 0% user + 0% kernel
E/ActivityManager(160): 0% 90/rild: 0% user + 0% kernel
E/ActivityManager(160): 0% 237/com.hu1.wallpaper.forest: 0% user + 0% kernel / faults: 28 minor
E/ActivityManager(160): 0% 1276/com.google.process.gapps: 0% user + 0% kernel
E/ActivityManager(160): 0% 25919/flush-138:13: 0% user + 0% kernel
E/ActivityManager(160): 0% 26459/AR6K Async: 0% user + 0% kernel
E/ActivityManager(160): 0% 26461/ksdioirqd/mmc1: 0% user + 0% kernel
E/ActivityManager(160): 0% 26467/wpa_supplicant: 0% user + 0% kernel
E/ActivityManager(160): 0% 27702/com.wssyncmldm: 0% user + 0% kernel / faults: 9 inor
E/ActivityManager(160): 0% 28103/com.android.vending: 0% user + 0% kernel / faults: 1 minor
E/ActivityManager(160): 4.1% TOTAL: 2.8% user + 1.2% kernel
E/ActivityManager(160): CPU usage from 1156ms to 1691ms later:
E/ActivityManager(160): 43% 28646/com.colors.pipemedia: 31% user + 12% kernel / ults: 729 minor 2 major
E/ActivityManager(160): 14% 28649/GC: 12% user + 1.7% kernel
E/ActivityManager(160): 8.7% 28646/olors.pipemedia: 3.5% user + 5.2% kernel
E/ActivityManager(160): 5.2% 28652/Compiler: 3.5% user + 1.7% kernel
E/ActivityManager(160): +0% 28674/Thread-28: 0% user + 0% kernel
E/ActivityManager(160): +0% 28675/RefQueueWorker@: 0% user + 0% kernel
E/ActivityManager(160): 10% 160/system_server: 3.5% user + 7.1% kernel / faults: 4 minor
E/ActivityManager(160): 10% 176/ActivityManager: 3.5% user + 7.1% kernel
E/ActivityManager(160): 0.6% 22/kswapd0: 0% user + 0.6% kernel
E/ActivityManager(160): 1.8% 65/bma_wq: 0% user + 1.8% kernel
E/ActivityManager(160): 0.7% 72/kondemand/0: 0% user + 0.7% kernel
E/ActivityManager(160): 0.8% 26461/ksdioirqd/mmc1: 0% user + 0.8% kernel
E/ActivityManager(160): 1% 28602/logcat: 1% user + 0% kernel
E/ActivityManager(160): 83% TOTAL: 35% user + 20% kernel + 26% iowait
E/(160): Dumpstate > /data/log/dumpstate_app_anr

我在点击按钮时调用这样的服务。

final Intent pm_intent = new Intent(AccountsActivity.this , PmService.class);
pm_intent.putExtra("Key", "gtalk service*****");
pm_intent.putExtra("user_name", acc.getAcc_Name());
pm_intent.putExtra("user_pass", acc.getAcc_Pass());
Thread t = new Thread(){
public void run(){
startService(pm_intent);
}
};
t.start();

我在点击按钮时停止这样的服务

final Intent gtalk_intent = new Intent(getActivity() , GtalkService.class);
Thread t = new Thread(){
public void run(){
getActivity().stopService(gtalk_intent);
}
};
t.start();

最佳答案

您收到 ANR,因此您正在 UI 线程上执行一些处理器密集型工作。

我看到您正在新的线程 中启动您的服务。虽然这看起来像 Service 将在新的 Thread 中启动,但实际上并非如此。如果要在新线程中运行服务的内容,则必须在服务内部创建新线程,在 onStartCommnand()onCreate() 中。尝试这样做。

关于android - 为什么我收到此服务错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14981433/

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