Skip to content

[Android] minSdk 24 builds crash below API 31 due to unguarded RemoteViews(Map) calls #242

Description

@zhenyu-hong

Library Version

2.2.0

React Native Version

0.86.2

React Version

19.2.3

Expo Version

57.0.14

Minimal Reproduction

  1. Create an Expo SDK 57 app using its default Android minSdk 24.
  2. Install @use-voltra/android-client@2.2.0.
  3. Configure a payload-driven Android widget with multiple size variants.
  4. Install a release build on Android 10 / API 29.
  5. Add the widget and call updateAndroidWidget.

Actual behavior:

The process terminates with:

NoSuchMethodError: No direct method <init>(Ljava/util/Map;)V in class Landroid/widget/RemoteViews

Expected behavior:

API 31+ should use RemoteViews(Map<SizeF, RemoteViews>). API 24–30 should receive a compatible single RemoteViews, or the plugin should reject and clearly document applications whose minSdk is below 31.

Additional Information

android/build.gradle currently declares:

minSdkVersion safeExtGet("minSdkVersion", 31)

An Expo root project supplies minSdkVersion = 24, so the fallback value is overridden. The module builds and installs successfully but crashes when the Android 12-only constructor is reached.

The unguarded constructor currently appears in three paths:

  • VoltraWidgetManager.updateWidgetDirect
  • VoltraWidgetUpdateWorker.doWork
  • VoltraRefreshActionCallback.onAction

A tested compatibility approach is:

  • API 31+: keep RemoteViews(sizeMapping)
  • API 24–30: choose the generated RemoteViews closest to the widget bounds from AppWidgetManager.getAppWidgetOptions

Running Android Lint with the effective minSdk 24 also reports additional NewApi findings involving API 26, API 31, and API 36 APIs. Some are feature-specific or may already have guarded reachability, but they suggest the package would benefit from an explicit supported-minSdk contract and CI coverage for API 24–30.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions