项目在平板电脑上无法运行,出现ANR

03-12 10:35:05.030: E/ActivityManager(127): ANR in com.xxxxx.app
03-12 10:35:05.030: E/ActivityManager(127): Reason: Executing service com.xxxxx.app/.service.xxxxService
03-12 10:35:05.030: E/ActivityManager(127): Load: 0.01 / 0.08 / 0.1
03-12 10:35:05.030: E/ActivityManager(127): CPU usage from 5134ms to 0ms ago:
03-12 10:35:05.030: E/ActivityManager(127): 2.5% 127/system_server: 0.7% user + 1.7% kernel / faults: 8 minor
03-12 10:35:05.030: E/ActivityManager(127): 0.9% 291/android.process.acore: 0.9% user + 0% kernel / faults: 65 minor
03-12 10:35:05.030: E/ActivityManager(127): 0.7% 5/kworker/u:0: 0% user + 0.7% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0.1% 3/ksoftirqd/0: 0% user + 0.1% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0% 183/com.android.systemui: 0% user + 0% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0% 189/dhd_watchdog: 0% user + 0% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0.1% 190/dhd_dpc: 0% user + 0.1% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0.1% 214/wpa_supplicant: 0.1% user + 0% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0% 996/kworker/1:2: 0% user + 0% kernel
03-12 10:35:05.030: E/ActivityManager(127): 0% 1105/kworker/0:2: 0% user + 0% kernel
03-12 10:35:05.030: E/ActivityManager(127): 2.2% TOTAL: 0.9% user + 1.1% kernel + 0% softirq
03-12 10:35:05.030: E/ActivityManager(127): CPU usage from 298ms to 824ms later:
03-12 10:35:05.030: E/ActivityManager(127): 7.4% 127/system_server: 0% user + 7.4% kernel
03-12 10:35:05.030: E/ActivityManager(127): 3.7% 146/ActivityManager: 0% user + 3.7% kernel
03-12 10:35:05.030: E/ActivityManager(127): 1.8% 145/er.ServerThread: 1.8% user + 0% kernel

03-12 10:35:05.030: E/ActivityManager(127): 3.7% TOTAL: 0% user + 3.7% kernel


好奇怪:


解决方法:在manifest.xml中添加

 android:targetSdkVersion="11"

Open your manifest file and update the<uses-sdk>element to setandroid:targetSdkVersionto"11". For example:

<manifest ... >
  <uses-sdk android:minSdkVersion="4" 
       android:targetSdkVersion="11" />
  <application ... >
    ...
  <application>
</manifest>


它的解释如下:

By targeting the Android 3.0 platform, the system automatically applies the holographic theme to each activity when your application runs on an Android 3.0 device. The holographic theme provides a new design for widgets, such as buttons and text boxes, and new styles for other visual elements. This is the standard theme for applications built for Android 3.0, so your application will look and feel consistent with the system and other applications when it is enabled.

Additionally, when an activity uses the holographic theme, the system enables theAction Barfor the activity and removes the Options Menu button in the system bar. The Action Bar replaces the traditional title bar at the top of the activity window and provides the user access to the activity's Options Menu.


今天发现问题原因并不在这里,好像是网络问题,因为网络不阻塞,导致程序启动不了,开起那个service的时候一直在阻塞,所以导致ANR

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值