Fenix: [Bug] NoSuchMethodError: No virtual method requestPinAppWidget

Created on 24 Jul 2020  ·  8Comments  ·  Source: mozilla-mobile/fenix

Steps to reproduce

  1. Be on a fresh profile
  2. Wait for the helper popup for installing a search widget to appear (see image below)
  3. Press _Add widget_

imageUNITO-UNDERSCORE!widget-s!

Expected behavior

Widget is added to the homescreen.

Actual behavior

The app crashes with the following stacktrace:

3a9b52e5-dd1a-4c57-844f-4401a56fc543
java.lang.NoSuchMethodError: No virtual method requestPinAppWidget(Landroid/content/ComponentName;Landroid/os/Bundle;Landroid/app/PendingIntent;)Z in class Landroid/appwidget/AppWidgetManager; or its super classes (declaration of 'android.appwidget.AppWidgetManager' appears in /system/framework/framework.jar)

* Sentry: https://sentry.prod.mozaws.net/operations/firefox-nightly/?query=752b6d987a2548d8b971cd178d2a21cb

java.lang.NoSuchMethodError: No virtual method requestPinAppWidget(Landroid/content/ComponentName;Landroid/os/Bundle;Landroid/app/PendingIntent;)Z in class Landroid/appwidget/AppWidgetManager; or its super classes (declaration of 'android.appwidget.AppWidgetManager' appears in /system/framework/framework.jar)
    at org.mozilla.fenix.cfr.-$$LambdaGroup$js$I-O-O7uBL4-9ef2zxQzc9APrMm8.onClick(java-style lambda group:6)
    at android.view.View.performClick(View.java:5280)
    at android.view.View$PerformClick.run(View.java:21239)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:234)
    at android.app.ActivityThread.main(ActivityThread.java:5526)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Device information

  • Android device: Sony Xperia Z2, Android 6.0.1
  • Fenix version:
    Nightly 200724 06:05 (Build #22060612)
    AC: 52.0.20200723130248, 69562438f
    GV: 80.0a1-20200722094100
    AS: 61.0.10
Discovery crash SearchWidget 🐞 bug

Most helpful comment

According to the Android Developer reference documentation, requestPinAppWidget was added in API level 26, but this device is on API level 23. So I guess this is an API-specific issue.

All 8 comments

According to the Android Developer reference documentation, requestPinAppWidget was added in API level 26, but this device is on API level 23. So I guess this is an API-specific issue.

Question for UX: Should we show the Search Widget CFR only for Android SDK >= 26, or should e show it for all devices and
change the message / action from the add widget button (maybe redirect to home screen ?) ? TY!

@brampitoyo for UX feedback

@mcarare Let’s not show the Search Widget CFR for Android 8.0 (API Level 26) and below.

If we merely redirect to the Android System homescreen, there would be nothing to show there. Furthermore, the API won’t let us pop any “Add widget” dialogue there, either.

How about redirecting API Level < 26 users to a SUMO article like How to add the search widget to your home screen or Add the Firefox Search widget to your home screen when pressing "Add widget"? This was the solution for an API-specific issue for the "Set as default browser" setting (see https://github.com/mozilla-mobile/fenix/issues/5898).

@hwinnemoe Your suggestion sounds really good.

I didn’t know that we’re able to show different versions of the button depending on API Level, instead of a black-and-white show/hide.

Let’s make the same button link to the SUMO article.

This article, specifically, seems like the correct one to link to:
https://support.mozilla.org/en-US/kb/how-add-firefox-preview-search-widget-your-home-screen

We just need to check that it refers to the correct product (release version, rather than Beta/Nightly).

FYI also seeing this on the latest nightly on Moto G XT1031 (Android 5.1).

This issue is obsolete, as the search widget experiment has finished and the CFR is to be removed in issue https://github.com/mozilla-mobile/fenix/issues/15929.

Was this page helpful?
0 / 5 - 0 ratings