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 app crashes at startDfu when targeting SDK version 31+ #166

Open
alfredcheuk opened this issue May 26, 2022 · 9 comments
Open

Android app crashes at startDfu when targeting SDK version 31+ #166

alfredcheuk opened this issue May 26, 2022 · 9 comments

Comments

@alfredcheuk
Copy link

When running startDfu function on Android while targeting SDK version 31, the app crashes directly without any errors thrown.

I used adb logcat to trace the log messages and found the following issue:
Screenshot 2022-05-26 at 2 56 33 AM
(masked out the project name that I am working on, and the first line was me printing the firmware file for debugging)

I am not the most familiar with logcat outputs but it seems that it ran into the exception on the highlighted line, then the app proceeded to crash directly.

I have tested that the exact same code works on iOS, as well as Android while targeting SDK version 30.

Does anyone have any idea whether this is something that needs to be changed on the library's side, or have I not configured it correctly specifically for SDK version 31?

@vkourtis
Copy link

vkourtis commented Jun 9, 2022

There is and open PR that fixes that #164

@alfredcheuk
Copy link
Author

Thank you so much, I will keep an eye out on this.

@vkourtis
Copy link

vkourtis commented Jun 9, 2022

Thank you so much, I will keep an eye out on this.

Check my comment on the PR. I was able to patch it with patch-package.

@fabiendem
Copy link

fabiendem commented Jun 17, 2022

Is there any maintainer left on this library? Would be good to merge this.

A targetSdkVersion set to Android 12 (API 31) will be mandatory in November 2022: https://support.google.com/googleplay/android-developer/answer/11926878

Cheers!

@fabiendem
Copy link

Fix available in this fork: https://github.com/Salt-PepperEngineering/react-native-nordic-dfu

@sachinsaini794
Copy link

sachinsaini794 commented Sep 22, 2022

as vkou said,

I've tested it on Android 12 and it's working. Node_modules were not updating code. It shows the 3.2.1 version in package.json, but the principle was not added to the node_modules folder, so I created the patch package and replaced the android folder. Everything is working now.

@kakonyitibor
Copy link

kakonyitibor commented Nov 22, 2022

Hello,
I had the same issue, the app crashed on startDFU with Android12.
I'm trying PR #164 and although it doesn't crash anymore, but process gets stuck in the DFU_PROCESS_STARTING state, then throws GATT ERROR. (I don't have this problem with older ANdroid versions. )
Can you help me please?
Thank you!

Edit: turned out that nRF Connect Mobile produces a similar behaviour with the Android12 phone I'm using, so this might be a device-specific bug in the Nordic Android DFU library.

@sachinsaini794
Copy link

sachinsaini794 commented Nov 24, 2022

@kakonyitibor have you used the patch for the react-native-nordic-dfu? if not please use it and update the code as in package 3.2.1.

compare with this https://github.com/Salt-PepperEngineering/react-native-nordic-dfu/blob/master/android/build.gradle

for example -
+def DEFAULT_COMPILE_SDK_VERSION = 31
+def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0'
+def DEFAULT_TARGET_SDK_VERSION = 31

@kakonyitibor
Copy link

@kakonyitibor have you used the patch for the react-native-nordic-dfu? if not please use it and update the code as in package 3.2.1.

compare with this https://github.com/Salt-PepperEngineering/react-native-nordic-dfu/blob/master/android/build.gradle

for example - +def DEFAULT_COMPILE_SDK_VERSION = 31 +def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0' +def DEFAULT_TARGET_SDK_VERSION = 31

Thanks for your reply.
Yes, I'm using the patch, build.gradle is the same as the one you linked. Thanks to this patch, DFU does not crash the app on Android 12 anymore. Now it just throws a GATT ERROR right after starting the DFU.

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

5 participants