Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jpobst opened this issue Sep 30, 2020 · 1 comment
Open

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

jpobst opened this issue Sep 30, 2020 · 1 comment
Assignees
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll).

Comments

@jpobst
Copy link
Contributor

jpobst commented Sep 30, 2020

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.

@jpobst jpobst added the Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). label Sep 30, 2020
@jpobst jpobst added this to the Under Consideration milestone Sep 30, 2020
@jpobst jpobst self-assigned this Sep 30, 2020
@jonpryor
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll).
Projects
None yet
Development

No branches or pull requests

2 participants