我从Google报告中获得了ANR,主要来自Galaxy Note3(hlte)和Galaxy Note II(t03g)。
我不知道发生了什么以及如何解决这个问题。
任何人都知道发生了什么事?
下面列出了堆栈跟踪。
----- pid 1958 at 2015-02-15 03:18:13 -----
Cmd line: aaron.apps.investtreasury
JNI: CheckJNI is off; workarounds are off; pins=0; globals=377 (plus 164 weak)
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"Thread-58085" prio=4 tid=24 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42db8368 self=0x7d215010
| sysTid=2622 nice=10 sched=0/0 cgrp=apps handle=-2117237328
| state=S schedstat=( 841459 109374 5 ) utm=0 stm=0 core=1
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b51611 /system/lib/libwebviewchromium.so
#04 pc 001dbdcf /system/lib/libwebviewchromium.so
#05 pc 001dc01b /system/lib/libwebviewchromium.so
#06 pc 001da25b /system/lib/libwebviewchromium.so
#07 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Thread-58086" prio=9 tid=1 VMWAIT
| group="main" sCount=1 dsCount=0 obj=0x42a16950 self=0x41689868
| sysTid=1958 nice=-6 sched=0/0 cgrp=apps handle=1074434388
| state=S schedstat=( 27452846837 3864925805 55720 ) utm=2251 stm=494 core=3
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 0004e043 /system/lib/libdvm.so
#04 pc 00053a01 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+416)
#05 pc 0000105b /system/bin/app_process
#06 pc 0000e51b /system/lib/libc.so (__libc_init+50)
#07 pc 00000d7c /system/bin/app_process
at dalvik.system.NativeStart.run(Native Method)
"Timer-16" prio=5 tid=16 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x42e08d58 self=0x81d503b0
| sysTid=2619 nice=0 sched=0/0 cgrp=apps handle=-2143166664
| state=S schedstat=( 247603 67969 2 ) utm=0 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x42e08d58> (a java.util.Timer$TimerImpl)
at java.lang.Object.wait(Object.java:401)
at java.util.Timer$TimerImpl.run(Timer.java:238)
"Thread-58080" prio=4 tid=35 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42c1c748 self=0x7d117a90
| sysTid=2603 nice=10 sched=0/0 cgrp=apps handle=2074908632
| state=S schedstat=( 11483855 9091094 47 ) utm=1 stm=0 core=0
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b51611 /system/lib/libwebviewchromium.so
#04 pc 001dbdcf /system/lib/libwebviewchromium.so
#05 pc 001dc01b /system/lib/libwebviewchromium.so
#06 pc 001da25b /system/lib/libwebviewchromium.so
#07 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Timer-14" prio=5 tid=33 WAIT
| group="main" sCount=1 dsCount=0 obj=0x42dc8e50 self=0x7d218f30
| sysTid=2604 nice=0 sched=0/0 cgrp=apps handle=2099352456
| state=S schedstat=( 407448 40469 3 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)
- waiting on <0x42dc8e50> (a java.util.Timer$TimerImpl)
at java.lang.Object.wait(Object.java:364)
at java.util.Timer$TimerImpl.run(Timer.java:214)
"Thread-58076" prio=4 tid=31 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42c7d550 self=0x7e5cee40
| sysTid=2591 nice=10 sched=0/0 cgrp=apps handle=-2117162912
| state=S schedstat=( 1817640510 333587022 3101 ) utm=151 stm=30 core=0
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b51611 /system/lib/libwebviewchromium.so
#04 pc 001dbdcf /system/lib/libwebviewchromium.so
#05 pc 001dc01b /system/lib/libwebviewchromium.so
#06 pc 001da25b /system/lib/libwebviewchromium.so
#07 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Thread-58074" prio=4 tid=22 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42a69fa0 self=0x7c008ee8
| sysTid=2587 nice=10 sched=0/0 cgrp=apps handle=2074912072
| state=S schedstat=( 686926 313907 5 ) utm=0 stm=0 core=3
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b51611 /system/lib/libwebviewchromium.so
#04 pc 001dbdcf /system/lib/libwebviewchromium.so
#05 pc 001dc01b /system/lib/libwebviewchromium.so
#06 pc 001da25b /system/lib/libwebviewchromium.so
#07 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Binder_4" prio=5 tid=29 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42cc6b40 self=0x76fb0220
| sysTid=2569 nice=0 sched=0/0 cgrp=apps handle=-2122036416
| state=S schedstat=( 2967551 1290206 38 ) utm=0 stm=0 core=2
#00 pc 00020754 /system/lib/libc.so (__ioctl+8)
#01 pc 0002ceeb /system/lib/libc.so (ioctl+14)
#02 pc 0001d3ed /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140)
#03 pc 0001daf7 /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6)
#04 pc 0001db8d /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
#05 pc 000219f1 /system/lib/libbinder.so
#06 pc 0000ea5d /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#07 pc 000523c9 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+68)
#08 pc 0000e58f /system/lib/libutils.so
#09 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#10 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Thread-58061" prio=4 tid=19 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42d0cc20 self=0x7b8b5c10
| sysTid=2561 nice=10 sched=0/0 cgrp=apps handle=2087667224
| state=S schedstat=( 489790 256980 6 ) utm=0 stm=0 core=3
#00 pc 00021ad0 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000f094 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000f0f4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b51611 /system/lib/libwebviewchromium.so
#04 pc 001dbdcf /system/lib/libwebviewchromium.so
#05 pc 001dc01b /system/lib/libwebviewchromium.so
#06 pc 001da25b /system/lib/libwebviewchromium.so
#07 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
"Binder_3" prio=5 tid=14 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x429c4d80 self=0x831b2700
| sysTid=2182 nice=0 sched=0/0 cgrp=apps handle=2025775992
| state=S schedstat=( 8851980 11506204 100 ) utm=0 stm=0 core=1
#00 pc 00020754 /system/lib/libc.so (__ioctl+8)
#01 pc 0002ceeb /system/lib/libc.so (ioctl+14)
#02 pc 0001d3ed /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140)
#03 pc 0001daf7 /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6)
#04 pc 0001db8d /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
#05 pc 000219f1 /system/lib/libbinder.so
#06 pc 0000ea5d /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#07 pc 000523c9 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+68)
#08 pc 0000e58f /system/lib/libutils.so
#09 pc 0000d2a0 /system/lib/libc.so (__thread_entry+72)
#10 pc 0000d438 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)
------------ 2015/02/17 ---------------
这是我使用的BroadcastReceiver的一部分。
public class ArticleBroadcastReceiver extends BroadcastReceiver {
private final String dogUrl = ...;
private final String richFriendUrl = ...;
private final String danielUrl = ...;
private final String thunderUrl = ...;
private final String earnfunUrl = ...;
private final String stockfishUrl = ...;
private final String jacksonUrl = ...;
private final String cmoneyUrl = ...;
private final String stocksurviveUrl = ...;
private final String aspirinUrl = ...;
private final String ebigmoneyUrl = ...;
private final String lchUrl = ...;
private final String ourstockinvestUrl = ...;
@Override
public void onReceive(Context context, Intent intent) {
if (AppUtilities.checkNetwork(context, false)) {
Log.e("Test", "onReceive");
Bundle bundle = intent.getExtras();
if (bundle.get(Init.NOTIFY_KEY).equals(Init.NOTIFY_VALUE)) {
int[] blog_array = bundle.getIntArray(Init.NOTIFY_BLOG);
if (blog_array == null) {
blog_array = new int[context.getResources().getStringArray(R.array.giant_array).length];
for (int i = 0; i < blog_array.length; i++)
blog_array[i] = i;
}
for (int i = 0; i < blog_array.length; i++) {
Intent intentService = null;
switch (blog_array[i]) {
case Init.DOG:
Log.e("Test", "DOG");
intentService = new Intent(context, DogArticleListService.class);
intentService.putExtra("url", dogUrl);
intentService.putExtra("blogger_resId", R.string.dog);
context.startService(intentService);
break;
case Init.RICHFRIEND:
Log.e("Test", "RICHFRIEND");
intentService = new Intent(context, RichFriendArticleListService.class);
intentService.putExtra("url", richFriendUrl);
intentService.putExtra("blogger_resId", R.string.richfriend);
context.startService(intentService);
break;
case Init.DANIEL:
Log.e("Test", "DANIEL");
intentService = new Intent(context, DanielArticleListService.class);
intentService.putExtra("url", danielUrl);
intentService.putExtra("blogger_resId", R.string.daniel);
context.startService(intentService);
break;
case Init.THUNDER:
Log.e("Test", "THUNDER");
intentService = new Intent(context, ThunderArticleListService.class);
intentService.putExtra("url", thunderUrl);
intentService.putExtra("blogger_resId", R.string.thunder);
context.startService(intentService);
break;
case Init.EARNFUN:
Log.e("Test", "EARNFUN");
intentService = new Intent(context, EarnFunArticleListService.class);
intentService.putExtra("url", earnfunUrl);
intentService.putExtra("blogger_resId", R.string.earnfun);
context.startService(intentService);
break;
case Init.STOCKFISH:
Log.e("Test", "STOCKFISH");
intentService = new Intent(context, StockFishArticleListService.class);
intentService.putExtra("url", stockfishUrl);
intentService.putExtra("blogger_resId", R.string.stockfish);
context.startService(intentService);
break;
case Init.JACKSON:
Log.e("Test", "JACKSON");
intentService = new Intent(context, JacksonArticleListSerivce.class);
intentService.putExtra("url", jacksonUrl);
intentService.putExtra("blogger_resId", R.string.jackson);
context.startService(intentService);
break;
case Init.CMONEY:
Log.e("Test", "Cmoney");
intentService = new Intent(context, CMoneyArticleListService.class);
intentService.putExtra("url", cmoneyUrl);
intentService.putExtra("blogger_resId", R.string.cmoney);
context.startService(intentService);
break;
case Init.STOCKSURVIVE:
Log.e("Test", "StockSurvive");
intentService = new Intent(context, StockSurviveArticleListService.class);
intentService.putExtra("url", stocksurviveUrl);
intentService.putExtra("blogger_resId", R.string.stocksurvive);
context.startService(intentService);
break;
case Init.ASPIRIN:
Log.e("Test", "Aspirin");
intentService = new Intent(context, AspirinArticleListService.class);
intentService.putExtra("url", aspirinUrl);
intentService.putExtra("blogger_resId", R.string.aspirin);
context.startService(intentService);
break;
case Init.EBIGMONEY:
Log.e("Test", "EBigMoney");
intentService = new Intent(context, EBigMoneyArticleListService.class);
intentService.putExtra("url", ebigmoneyUrl);
intentService.putExtra("blogger_resId", R.string.ebigmoney);
context.startService(intentService);
break;
case Init.LCH:
Log.e("Test", "LCH");
intentService = new Intent(context, LCHArticleListService.class);
intentService.putExtra("url", lchUrl);
intentService.putExtra("blogger_resId", R.string.lch);
context.startService(intentService);
break;
case Init.OURSTOCKINVEST:
Log.e("Test", "OurStockInvest");
intentService = new Intent(context, OurStockInvestArticleListService.class);
intentService.putExtra("url", ourstockinvestUrl);
intentService.putExtra("blogger_resId", R.string.ourstockinvest);
context.startService(intentService);
break;
}
}
}
}
而且,我的AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="aaron.apps.investtreasury"
android:versionCode="46"
android:versionName="2.21" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashScreen"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyDogContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".VersionInfo"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name=".About"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Settings"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".MyFavorite"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".History"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyDanielContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEarnFunAll"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEarnFunSub"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEarnFunContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyOurStockInvestAll"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyOurStockInvestSub"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyOurStockInvestContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyThunderContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyRichFriendContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyJacksonContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyCMoneyContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyCMoneyAll"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyCMoneySub"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyCMoneyCourseSub"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyCMoneyCourseContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyStockSurviveContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyStockFishContent"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyStockFishAll"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyStockFishSub"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyAspirinContent"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyLCHContent"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyGreenHornContent"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEBigMoneyAll"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEBigMoneySub"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EasyMoneyEBigMoneyContent"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="true" >
</activity>
<activity
android:name="com.vpadn.widget.VpadnActivity"
android:configChanges="orientation|keyboardHidden|navigation|keyboard|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent" >
</activity>
<activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="db-jsoy35upqya5c4q" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name="com.dropbox.sync.android.DbxSyncService"
android:enabled="true"
android:exported="false"
android:label="Dropbox Sync" />
<receiver
android:name="aaron.apps.notification.ArticleBroadcastReceiver"
android:exported="false" >
<intent-filter>
<action android:name="ArticleBroadcastReceiver" />
</intent-filter>
</receiver>
<receiver android:name="aaron.apps.notification.AlarmInitReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="aaron.apps.notification.CMoneyArticleListService" />
<service android:name="aaron.apps.notification.DanielArticleListService" />
<service android:name="aaron.apps.notification.DogArticleListService" />
<service android:name="aaron.apps.notification.EarnFunArticleListService" />
<service android:name="aaron.apps.notification.JacksonArticleListSerivce" />
<service android:name="aaron.apps.notification.RichFriendArticleListService" />
<service android:name="aaron.apps.notification.StockFishArticleListService" />
<service android:name="aaron.apps.notification.ThunderArticleListService" />
<service android:name="aaron.apps.notification.StockSurviveArticleListService" />
<service android:name="aaron.apps.notification.AspirinArticleListService" />
<service android:name="aaron.apps.notification.EBigMoneyArticleListService" />
<service android:name="aaron.apps.notification.LCHArticleListService" />
<service android:name="aaron.apps.notification.GreenHornArticleListService" />
<service android:name="aaron.apps.notification.OurStockInvestArticleListService" />
</application>
</manifest>
答案 0 :(得分:1)
您正在循环启动一个新的 IntentService 。这可能是沉重的逻辑。解决问题的方法是确保在不到 10 秒的时间内完成BroadcastReceiver内部的整个onReceive
方法。