natiginfo / QRScannerCameraX

QR code scanner for Android
https://www.natigbabayev.com/2019-07-13/building-qr-code-scanner-for-android-using-firebase-ml-kit-and-camerax
Apache License 2.0
50 stars 18 forks source link

Getting a an error on imageAnalysis.analyze=qrCodeAnalyzer #5

Open guitarcrazy86 opened 4 years ago

guitarcrazy86 commented 4 years ago

Android Studio is saying that "Val cannot be reassigned", I'm assuming because imageAnalysis is assigned to "ImageAnalysis(imageAnalysisConfig" already.

Any way to fix this?

mortenholmgaard commented 4 years ago

I figured out how to solve this a long with the upgrade to alpha06:

imageAnalysis.setAnalyzer(Executors.newFixedThreadPool(5), qrCodeAnalyzer)

And change this

preview.setOnPreviewOutputUpdateListener { previewOutput ->
    val parent = textureView.parent as ViewGroup
    parent.removeView(textureView)
    textureView.surfaceTexture = previewOutput.surfaceTexture
    parent.addView(textureView, 0)
}