fix(android): avoid calling getJSModule in init#3623
Merged
mrousavy merged 1 commit intomrousavy:mainfrom Sep 8, 2025
Merged
Conversation
sendAvailableDevicesChangedEvent() calls getJSModule from init, causing IllegalStateException: "getJSModule should only happen once initialize() has been called".
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
would be great to have this fix released in the next version soon 👍 |
5 tasks
zehra-tok
pushed a commit
to tos-analytics/react-native-vision-camera
that referenced
this pull request
Oct 21, 2025
sendAvailableDevicesChangedEvent() calls getJSModule from init, causing IllegalStateException: "getJSModule should only happen once initialize() has been called".
|
@mrousavy Can we maybe get a release with this fix? It currently causes a crash on productions for users that launch the app for the first time after install. Applying this path manually resolves this issue. I guess it is a timing / race condition. But clearly, this patch does fix it. |
Owner
|
released
… On 12.11.2025, at 16:18, mattijsf ***@***.***> wrote:
mattijsf
left a comment
(mrousavy/react-native-vision-camera#3623)
<#3623 (comment)>
@mrousavy <https://github.com/mrousavy> Can we maybe get a release with this fix? It currently causes a crash on productions for users that launch the app for the first time after install. Applying this path manually resolves this issue. I guess it is a timing / race condition. But clearly, this patch does fix it.
—
Reply to this email directly, view it on GitHub <#3623 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADT6WN23QGI2PWP3QSOOUID34NFTRAVCNFSM6AAAAACFYJVEZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMRSGM4TSOJXG4>.
You are receiving this because you were mentioned.
|
This was referenced Nov 17, 2025
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sendAvailableDevicesChangedEventis callinggetJSModulefrom init (introduced in PR #3575), which could crash withIllegalStateException: "getJSModule should only happen once initialize() has been called".react-native-vision-camera/package/android/src/main/java/com/mrousavy/camera/react/CameraDevicesManager.kt
Lines 62 to 76 in 5206c78
Now JS events are emitted safely from initialize() after React is ready.
Changes
sendAvailableDevicesChangedEvent()call frominittoinitialize()Tested on
Related issues