dotnet / dotnet/android

App crashes invoking method in package

Open
#9,798 4 comments 0 reactions 0 assignees View on GitHub
Area: App Runtime
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

### Android framework version

net9.0-android

### Affected platform version

VS 2022 17.13.0

### Description

Application uses an external library.
When the library is referenced from the main project eveythong works.
When the library is used as package a runtime error occurs

### Steps to Reproduce

[BarcodeDemo.zip](https://github.com/user-attachments/files/18803484/BarcodeDemo.zip)

The attached demo project contains a BarcodeDemo app, which reference a ZXing.Mobile package. The package is served from the local directory LocalLibs.
The app has a single activity with a single button "Scan", which should bring up a scanning activity. The scanning activity use the device camera to read a barcode and decode it using ZXing.Net. The library is my porting to Net 9 of the no-longer mantained https://github.com/Redth/ZXing.Net.Mobile

If you run the app on an Android 5 or 6, pressing the "Scan" button throws an unhandled exception at row 60 of ZxingActivity.cs. Row 60 was recently added to handle edge-to-edge as required by Android 15.

![Image](https://github.com/user-attachments/assets/5346166f-1286-41e2-8e39-293d97491c6e)

### Did you find any workaround?

The app works correctly if:

1. Executed on Android > 6, or
2. Executed referencing directly the library from the main project instead of using a package

Working configuration

![Image](https://github.com/user-attachments/assets/878b63d2-b2ae-4b68-9078-b67c7ec950ce)

Failing configuration

![Image](https://github.com/user-attachments/assets/277f90a7-c27c-49a5-a105-6708f7348bf4)

### Relevant log output

```shell

```

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.