AppWidgetHost崩溃android.os.TransactionTooLargeException [英] AppWidgetHost crash android.os.TransactionTooLargeException

查看:1527
本文介绍了AppWidgetHost崩溃android.os.TransactionTooLargeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个定制的Andr​​oid启动。之后,我添加一些小部件(三星画廊,收藏直拨),我每次重新启动应用时,我得到一个崩溃。这是code:

I'm working on a custom android launcher. After I add some widgets (Samsung gallery, Favourite direct dial), every time I restart the app I obtain a crash. This is the code:

public static final int APPWIDGET_HOST_ID = 128;

    public final class Launcher extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); 
        mAppWidgetManager = AppWidgetManager.getInstance(this);
        mAppWidgetHost = new AppWidgetHost(this, APPWIDGET_HOST_ID);
        mAppWidgetHost.startListening(); //Here it crash
        ...
    }
}

这是错误日志:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{custom.launcherpro/custom.launcher.launcher.Launcher}: java.lang.RuntimeException: system server dead?
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
    at android.app.ActivityThread.access$900(ActivityThread.java:161)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5356)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.RuntimeException: system server dead?
    at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:166)
    at custom.launcher.launcher.Launcher.onCreate(Launcher.java:181)
    at android.app.Activity.performCreate(Activity.java:5426)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
    ... 11 more
 Caused by: android.os.TransactionTooLargeException
    at android.os.BinderProxy.transact(Native Method)
    at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.startListening(IAppWidgetService.java:465)
    at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:162)

这发生在Android 4.4的(但即使在旧Android版本)
这是什么意思?我怎样才能prevent呢?

This happens on android 4.4 (but even on older android version) What does it mean? How can I prevent it?

感谢您,
文森佐

Thank you, Vincenzo

推荐答案

请参见 TransactionTooLargeException 的文档。如果你看一下源AppWidgetHost你会发现你的踪迹提到这个code:

See TransactionTooLargeException in the docs. If you look at the source for AppWidgetHost you will find this code mentioned in your trace:

ArrayList<RemoteViews> updatedViews = new ArrayList<RemoteViews>();
// ....
updatedIds = sService.startListening(mCallbacks, mPackageName, mHostId, updatedViews);

在这种情况下,updatedViews是RemoteViews的阵列。这些可以说是相当大的,如果它们含有大量的图片。你有一些小部件与庞大的图像,他们还是怎么的?

In this case the updatedViews is an array of RemoteViews. Those can be quite large if they contain a lot of images. Do you have some widgets with huge images in them or something?

这篇关于AppWidgetHost崩溃android.os.TransactionTooLargeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆