bug: NullPointerException
during startScan(...)
with capacitor inside an Android fragment
#160
Open
5 of 11 tasks
Labels
bug/fix
Something isn't working
needs: triage
package: barcode-scanning
platform: android
Android platform
Plugin(s)
Version
6.1.0
Platform(s)
Current behavior
Hi there.
So I have kind of a specific android app structure with multiple android fragments, and with capacitor instanciated in one of them using
BridgeFragment
class. The particularity is that plugins are not automatically loaded when using this class, you have to manually add each plugin inside the fragment class as stated here ionic-team/capacitor#5564 (comment).This works well, except for the barcode scanning plugin, which produces the famous
NullPointerException
duringstartScan(...)
despite having data binding enabled.My guess is that the following code breaks because the app doesn't find the preview view since the plugin is instanciated in a fragment ?
I'm a beginner android developer so I'm kind of lost here as to where the problem lies exactly. I'm aware that my app's implementation with fragment is rather advanced so I'll understand if it's not something you want to support in your plugin.
Expected behavior
No error during scan.
Reproduction
https://github.com/LoicUV/scanner-example
Steps to reproduce
SCAN BARCODE
buttonOther information
No response
Capacitor doctor
Before submitting
The text was updated successfully, but these errors were encountered: