dotnet / dotnet/android

UnsatisfiedLinkError when trying to override RegisterReceiver in Application inheritor

Open
#9,334 7 comments 0 reactions 1 assignee Assigned to @jonpryor View on GitHub
Area: App Runtime bug
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

### Android framework version

net8.0-android

### Affected platform version

.NET 8.0.303
Tried on Android 12 (Samsung) and Android 14 (Pixel)

### Description

Not a lot to describe: trying override `RegisterReceiver(BroadcastReceiver? receiver, IntentFilter? filter)` results in `java.lang.UnsatisfiedLinkError`.
The full message is:
`java.lang.UnsatisfiedLinkError: No implementation found for android.content.Intent crc645671ac291747a43a.SampleApplication.n_registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) (tried Java_crc645671ac291747a43a_SampleApplication_n_1registerReceiver and Java_crc645671ac291747a43a_SampleApplication_n_1registerReceiver__Landroid_content_BroadcastReceiver_2Landroid_content_IntentFilter_2) - is the library loaded, e.g. System.loadLibrary?`

### Steps to Reproduce

Create new Android application, add Application class inheritor and override `RegisterReceiver(BroadcastReceiver? receiver, IntentFilter? filter)` method.
Anyway, you can try the [attached sample](https://github.com/user-attachments/files/17145653/RegisterReceiverSample.zip)

### Did you find any workaround?

Any workaround would be appreciated.

### Relevant log output

```shell
java.lang.UnsatisfiedLinkError: No implementation found for android.content.Intent crc645671ac291747a43a.SampleApplication.n_registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) (tried Java_crc645671ac291747a43a_SampleApplication_n_1registerReceiver and Java_crc645671ac291747a43a_SampleApplication_n_1registerReceiver__Landroid_content_BroadcastReceiver_2Landroid_content_IntentFilter_2) - is the library loaded, e.g. System.loadLibrary?
at crc645671ac291747a43a.SampleApplication.n_registerReceiver(Native Method)
at crc645671ac291747a43a.SampleApplication.registerReceiver(SampleApplication.java:34)
at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:39)
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:35)
at android.app.ActivityThread.installProvider(ActivityThread.java:8220)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7728)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7482)
at android.app.ActivityThread.access$1600(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2281)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.