AppWidgetHost android.os.TransactionTooLargeException application error

I am working on a custom installation of Android. After adding some widgets (Samsung gallery, direct dial selection) every time I restart the application, I get 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 ... } } 

This is the error log:

  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) 

This happens on Android 4.4 (but even on the old version for Android) What does this mean? How can I prevent this?

Thank you Vincenzo

+2
source share
1 answer

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); 

In this case, updateViews is an array of RemoteViews. They can be quite large if they contain a lot of images. Do you have some widgets with huge images in them or something like that?

+1
source

Source: https://habr.com/ru/post/1271937/


All Articles