The Launcher crashes on Android Lollipop when adding a Widget giving the following message (It works fine on previous Android versions):
Edit: This only happens in landscape orientation.
12-16 12:35:10.208: E/AndroidRuntime(960): java.lang.RuntimeException: Unable to resume activity {com.android.launcher/com.android.launcher2.Launcher}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=5, result=-1, data=Intent { (has extras) }} to activity {com.android.launcher/com.android.launcher2.Launcher}: java.lang.NullPointerException: Attempt to read from field 'android.content.pm.ActivityInfo android.appwidget.AppWidgetProviderInfo.providerInfo' on a null object reference 12-16 12:35:10.208: E/AndroidRuntime(960): at android.appwidget.AppWidgetHostView.getRemoteContext(AppWidgetHostView.java:465) 12-16 12:35:10.208: E/AndroidRuntime(960): at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:376) 12-16 12:35:10.208: E/AndroidRuntime(960): at com.android.launcher2.LauncherAppWidgetHostView.updateAppWidget(LauncherAppWidgetHostView.java:54) 12-16 12:35:10.208: E/AndroidRuntime(960): at android.appwidget.AppWidgetHost.createView(AppWidgetHost.java:325) 12-16 12:35:10.208: E/AndroidRuntime(960): at com.android.launcher2.Launcher.completeTwoStageWidgetDrop(Launcher.java:703) 12-16 12:35:10.208: E/AndroidRuntime(960): at com.android.launcher2.Launcher.onActivityResult(Launcher.java:664) This is the provider info:
<?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="201dp" android:minHeight="201dp" android:updatePeriodMillis="180000" android:initialLayout="@layout/appwidget_week" android:configure="com.example.myApp.Widgets.Configure.WidgetConfigure_Week" android:resizeMode="horizontal|vertical" android:previewImage="@drawable/widget_screenshot_week" android:label="@string/widget_week"> </appwidget-provider> And the manifest:
<receiver android:name="com.example.myApp.Widgets.Provider.WidgetProvider_Week" android:enabled="@bool/is_above_version_3_1" android:label="@string/widget_week" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_week_provider_info" /> </receiver>