Skip to content

[Mono.Android] Bound constructors no longer exist in Android #5172

Description

@jpobst

From an automated scan, the following constructors bound in Mono.Android.dll no longer exist on recent versions of Android. (That is, attempting to call them returns NoSuchMethodError).

- Android.Webkit.CacheManager - no non-static method "Landroid/webkit/CacheManager;.<init>()V"
  - Class removed in API-17
- Android.Webkit.Plugin - no non-static method "Landroid/webkit/Plugin;.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"
  - Class removed in API-15
- Android.Webkit.PluginList - no non-static method "Landroid/webkit/PluginList;.<init>()V"
  - Class removed in API-15
- Android.Webkit.UrlInterceptRegistry - no non-static method "Landroid/webkit/UrlInterceptRegistry;.<init>()V"
  - Class removed in API-15
- Android.Renderscripts.RSTextureView - no non-static method "Landroid/renderscript/RSTextureView;.<init>(Landroid/content/Context;)V"
  - Package does not exist in API-10
- Android.Renderscripts.RSTextureView - no non-static method "Landroid/renderscript/RSTextureView;.<init>(Landroid/content/Context;Landroid/util/AttributeSet;)V"
  - Package does not exist in API-10
- Android.Util.Config - no non-static method "Landroid/util/Config;.<init>()V"
  - Constructor removed in API-15
- Android.Util.DebugUtils - no non-static method "Landroid/util/DebugUtils;.<init>()V"
  - Constructor removed in API-15
- Android.Util.EventLog - no non-static method "Landroid/util/EventLog;.<init>()V"
  - Constructor removed in API-15
- Android.Util.StateSet - no non-static method "Landroid/util/StateSet;.<init>()V"
  - Constructor removed in API-15
- Android.Util.TimeUtils - no non-static method "Landroid/util/TimeUtils;.<init>()V"
  - Constructor removed in API-15
- Android.Util.Xml - no non-static method "Landroid/util/Xml;.<init>()V"
  - Constructor removed in API-15

For example, for Android.Util.StateSet:

api-10.xml.class-parse contains:

<constructor deprecated="not deprecated" final="false" name="StateSet" static="false" visibility="public" bridge="false" synthetic="false" jni-signature="()V" />

but api-15.xml.class-parse does not contain this constructor.

Since these breakages are all prior to our current minimum supported Android version, we could possibly remove them even though it is technically an API break.

We should do something to help users know at compile time about these issues, rather than hitting exceptions at runtime.

Activity

  1. added this to the Under Consideration milestone on Sep 30, 2020
  2. self-assigned this
    on Sep 30, 2020
  3. jonpryor commented on Sep 30, 2020

    @jonpryor
    Contributor

    We should do something

    Minimum "something" part 1: Mark them as [Obsolete("…", error:true)], so that it's a compile-time error to use them.

    Unfortunately, this won't help if the referencing member is in e.g. a NuGet package.

    Less-minimal Part 2: An XA2000-style warning (error?) (4eb846d) if the member is still referenced after the linker executes.

    Part 3: Can we figure out how to detect this scenario and "automagically update" the infrastructure to when a member "disappears" in a later API Level?

  4. locked and limited conversation to collaborators on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions