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

Android SecurityException when starting update #30

Open
Silverdark opened this issue Jan 31, 2024 · 4 comments
Open

Android SecurityException when starting update #30

Silverdark opened this issue Jan 31, 2024 · 4 comments

Comments

@Silverdark
Copy link

Describe the bug
When trying to start an update with DFU a SecurityException is thrown.

Java.Lang.RuntimeException: Unable to create service crc640fd658db7faaed21.DfuServiceDelegate: java.lang.SecurityException: com.appid: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
 ---> Java.Lang.SecurityException: com.appid: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
 ---> Android.OS.RemoteException: Remote stack trace:
	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14008)
	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2585)
	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2763)
	at android.os.Binder.execTransactInternal(Binder.java:1363)
	at android.os.Binder.execTransact(Binder.java:1304)
...

To Reproduce
Steps to reproduce the behavior:

Call the Start method for the DFU installation:

var installation = new DfuInstallation(deviceId, file);
installation.Start(new DfuConfiguration());

Expected behavior
Update with DFU should start.

Smartphone:

  • Device: Google Pixel 6
  • OS: Android 14

Additional context

As far as I understand this happens only if the target SDK level is at 34 and your phone has Android 14 installed.
Looks like an issue with the Android Nordic library NordicSemiconductor/Android-DFU-Library#412 maybe it is already fixed with an update.

@ISSPRO-Eng
Copy link

@Silverdark @ksidirop-laerdal Looks like Android Bindings package just needs to be updated to target the updated Nordic package since they released a fix a while ago

@Silverdark
Copy link
Author

@ISSPRO-Eng I tried to update the Nordic package but it fails, see NordicSemiconductor/Android-DFU-Library#428

@ISSPRO-Eng
Copy link

@Silverdark Okay will do. I am still pretty green to nuget packages so may be some time

@christian-strydom
Copy link

christian-strydom commented Jul 12, 2024

I managed to get the DFU library running smoothly on MAUI Android. But we're still busy porting our one Xamarin app to MAUI and will only be done next year due to the sheer size of the app. The deadlines seemed fine until we realised that we're not targeting Android 14 SDK yet, and need to do so before August 31st.

I've taken the DFU aar and gson jar that's on the MAUI package and built a new Xamarin bindings NuGet, but unfortunately still running into the RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED exception on Xamarin but not on MAUI. Also tried to build my own aar from the latest native Nordic Android library, but building a Xamarin bindings nuget with that unfortunately results in an exception when trying to build my project with the bindings nuget:

Error in obj\Debug\130\lp\154\jl\bin\classes.jar:no/nordicsemi/android/dfu/BaseButtonlessDfuImpl$ButtonlessBluetoothCallback.class:
java.lang.NullPointerException
 Cannot invoke "String.length()" because "<parameter1>" is null
Compilation failed with an internal error.
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\130\lp\154\jl\bin\classes.jar

I've been trying to warn the company ever since NET 8 official release that we need to start with porting sooner, knowing that we'd end up in a situation like this because none of the Xamarin libraries are maintained anymore. 😔

I don't mean to hijack this thread, but any advice would be greatly appreciated. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants