---
title: "RemoteView 异常"
author: "hold_on"
date: "2013-11-15T15:34:27Z"
tags: []
categories: ["移动开发"]
slug: "remoteview"
draft: false
lastmod: "2013-11-15T15:34:27Z"
id: 1975260
url: "https://hold-on.iteye.com/blog/1975260"
---

01-03 13:20:36.687: E/AndroidRuntime(8513): FATAL EXCEPTION: main

01-03 13:20:36.687: E/AndroidRuntime(8513): android.app.RemoteServiceException: Bad notification posted from package com.zl: Couldn't expand RemoteViews for: StatusBarNotification(package=com.zl id=224968 tag=null notification=Notification(vibrate=null,sound=null,defaults=0x0,flags=0x2))

01-03 13:20:36.687: E/AndroidRuntime(8513): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1048)

01-03 13:20:36.687: E/AndroidRuntime(8513): at android.os.Handler.dispatchMessage(Handler.java:99)

01-03 13:20:36.687: E/AndroidRuntime(8513): at android.os.Looper.loop(Looper.java:130)

01-03 13:20:36.687: E/AndroidRuntime(8513): at android.app.ActivityThread.main(ActivityThread.java:3687)

01-03 13:20:36.687: E/AndroidRuntime(8513): at java.lang.reflect.Method.invokeNative(Native Method)

01-03 13:20:36.687: E/AndroidRuntime(8513): at java.lang.reflect.Method.invoke(Method.java:507)

01-03 13:20:36.687: E/AndroidRuntime(8513): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)

01-03 13:20:36.687: E/AndroidRuntime(8513): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)

01-03 13:20:36.687: E/AndroidRuntime(8513): at dalvik.system.NativeStart.main(Native Method)

 

该bug目前只发现会在 Samsung S5830i（系统版本：android 2.3.6） 上出现

bug产生原因：

```
Notification n = new Notification();
RemoteViews expandedView = new RemoteViews("com.zl.MainActivity",
						R.layout.status_progress_bar);
n.contentView = expandedView;
```

 R.layout.status\_progress\_bar 使用了自定义的 ProgressBar的子类，导致报找不到该类的错误

RemoteViews 

不过这个bug在其他机器上没有出现过