Android CameraX VideoRecorder error > Encoder cannot created : null - android

I am building an Android app that records video using Camera X.
The probe in a Samsung A52 and it works correctly.
When running on a Galaxy Core A03 I get these errors:
E/Recorder: Unable to initialize video encoder.
androidx.camera.video.internal.encoder.InvalidConfigException: Encoder cannot created: null
at androidx.camera.video.internal.workaround.EncoderFinder.findEncoder(EncoderFinder.java:88)
at androidx.camera.video.internal.encoder.EncoderImpl.(EncoderImpl.java:214)
at androidx.camera.video.Recorder.setupVideo(Recorder.java:1294)
at androidx.camera.video.Recorder.initializeInternal(Recorder.java:998)
at androidx.camera.video.Recorder.lambda$onSurfaceRequested$0$androidx-camera-video-Recorder(Recorder.java:396)
at androidx.camera.video.Recorder$$ExternalSyntheticLambda16.run(Unknown Source:4)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$1.run(SequentialExecutor.java:111)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7815)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1094)
Caused by: java.lang.NullPointerException
at android.media.MediaCodec.native_setup(Native Method)
at android.media.MediaCodec.(MediaCodec.java:1912)
at android.media.MediaCodec.createByCodecName(MediaCodec.java:1890)
at androidx.camera.video.internal.workaround.EncoderFinder.findEncoder(EncoderFinder.java:85)
at androidx.camera.video.internal.encoder.EncoderImpl.(EncoderImpl.java:214) 
at androidx.camera.video.Recorder.setupVideo(Recorder.java:1294) 
at androidx.camera.video.Recorder.initializeInternal(Recorder.java:998) 
at androidx.camera.video.Recorder.lambda$onSurfaceRequested$0$androidx-camera-video-Recorder(Recorder.java:396) 
at androidx.camera.video.Recorder$$ExternalSyntheticLambda16.run(Unknown Source:4) 
at androidx.camera.core.impl.utils.executor.SequentialExecutor$1.run(SequentialExecutor.java:111) 
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231) 
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7815) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1094) 
D/Recorder: Transitioning Recorder internal state: INITIALIZING --> ERROR
D/PreviewView: Surface requested by Preview.
D/SurfaceViewImpl: Surface created.
D/SurfaceViewImpl: Surface changed. Size: 960x720
D/PreviewView: Preview transformation info updated. TransformationInfo{cropRect=Rect(0, 0 - 960, 720), rotationDegrees=90, targetRotation=0}
D/PreviewTransform: Transformation info set: TransformationInfo{cropRect=Rect(0, 0 - 960, 720), rotationDegrees=90, targetRotation=0} 960x720 false
D/SurfaceViewImpl: Surface set on Preview.
D/SyncCaptureSessionBase: [androidx.camera.camera2.internal.SynchronizedCaptureSessionBaseImpl#d97cfb7] getSurface...done
D/Camera2CameraImpl: {Camera#1dd1e08[id=0]} Posting surface closed
java.lang.Throwable
at androidx.camera.camera2.internal.Camera2CameraImpl.postSurfaceClosedError(Camera2CameraImpl.java:1174)
at androidx.camera.camera2.internal.Camera2CameraImpl$2.onFailure(Camera2CameraImpl.java:1116)
at androidx.camera.core.impl.utils.futures.Futures$CallbackListener.run(Futures.java:340)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
D/DeferrableSurface: surface closed, useCount=0 closed=true androidx.camera.core.SurfaceRequest$2#3051f61
D/DeferrableSurface: Surface terminated[total_surfaces=2, used_surfaces=0](androidx.camera.core.SurfaceRequest$2#3051f61}
D/DeferrableSurface: Surface created[total_surfaces=3, used_surfaces=0](androidx.camera.core.SurfaceRequest$2#8dfc68e}
D/Recorder: Surface is requested in state: ERROR, Current surface: 0
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mrkevin574.teteo, PID: 16045
java.lang.IllegalStateException: Surface was requested when the Recorder had encountered error androidx.camera.video.internal.ResourceCreationException: androidx.camera.video.internal.encoder.InvalidConfigException: Encoder cannot created: null
at androidx.camera.video.Recorder.onSurfaceRequested(Recorder.java:406)
at androidx.camera.video.VideoCapture.createPipeline(VideoCapture.java:416)
at androidx.camera.video.VideoCapture.resetPipeline(VideoCapture.java:482)
at androidx.camera.video.VideoCapture.lambda$createPipeline$0$androidx-camera-video-VideoCapture(VideoCapture.java:433)
at androidx.camera.video.VideoCapture$$ExternalSyntheticLambda0.onError(Unknown Source:10)
at androidx.camera.camera2.internal.Camera2CameraImpl.lambda$postSurfaceClosedError$14(Camera2CameraImpl.java:1175)
at androidx.camera.camera2.internal.Camera2CameraImpl$$ExternalSyntheticLambda7.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7815)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1094)
V/FA: Recording user engagement, ms: 3688
D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
D/TransportRuntime.JobInfoScheduler: Scheduling upload for context TransportContext(cct, HIGHEST, MSRodHRwczovL2NyYXNobHl0aWNzcmVwb3J0cy1wYS5nb29nbGVhcGlzLmNvbS92MS9maXJlbG9nL2xlZ2FjeS9iYXRjaGxvZ1xBSXphU3lCcnBTWVQ0RkZMMDlyZUhKaTZIOUZZZGVpU25VVE92Mk0=) with jobId=-1451806366 in 1000ms(Backend next call timestamp 1649111614302). Attempt 1
I/Process: Sending signal. PID: 16045 SIG: 9
here the code of getVideoCapture():
private fun getVideoCapture() : VideoCapture<Recorder>{
val qualitySelector = QualitySelector.fromOrderedList(
listOf(Quality.UHD, Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
)
val recorder = Recorder.Builder()
.setExecutor(ContextCompat.getMainExecutor(requireContext()))
.setQualitySelector(qualitySelector)
.build()
return VideoCapture.withOutput(recorder)
}
I have it exactly as the Android documentation tells me.

I'm also having the same error after learning about CameraX at the following link https://developer.android.com/codelabs/camerax-getting-started
I think it's true what Morrison Chang said, there is something problem with Low End Android devices.
So I downgraded the quality of the Recorder contained inside the startCamera() function from HIGHEST to SD or HD and it's work.
val recorder = Recorder.Builder()
//.setQualitySelector(QualitySelector.from(Quality.HIGHEST))
.setQualitySelector(QualitySelector.from(Quality.SD))//change to Quality.SD or Quality.HD
.build()
videoCapture = VideoCapture.withOutput(recorder)

Related

Google pay library to scan debit/credit card details like card number, expiry date and CVV, facing an issue on Production its working on QA

I have implemented the google pay library to scan debit/credit card details, its working fine in the QA environment but when I try to test it on production I am facing a crash.
https://developers.google.com/pay/payment-card-recognition/debit-credit-card-recognition
private fun createPaymentsClient(activity: Activity): PaymentsClient {
val walletOptions = Wallet.WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_PRODUCTION)
.build()
return Wallet.getPaymentsClient(activity, walletOptions)
}
when I change environment to "WalletConstants.ENVIRONMENT_PRODUCTION" from "setEnvironment(Constants.PAYMENTS_ENVIRONMENT)" facing the crash below is crash log
FATAL EXCEPTION: main
Process: com.dhl.pay.google, PID: 5219
kotlin.UninitializedPropertyAccessException: lateinit property cardRecognitionPendingIntent has not been initialized
at com.dhl.pay.google.MainActivity.startPaymentCardOcr(MainActivity.kt:80) at com.dhl.pay.google.MainActivity.onCreate$lambda$0(MainActivity.kt:38) at com.dhl.pay.google.MainActivity.$r8$lambda$9ZIx61lkQCSM4mTsrQGymHGsZ_g(Unknown Source:0) at com.dhl.pay.google.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7488)
at android.view.View.performClickInternal(View.java:7464) at android.view.View.access$3700(View.java:841)
at android.view.View$PerformClick.run(View.java:28911)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8212)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Trying CameraX 1.1.0-beta02 on Emulator x86 API30 or x86_64 API31 causing android.hardware.camera2.CameraAccessException

I am implementing a CameraActivity using CameraX with the current latest version 1.1.0-beta01 / 1.1.0-beta02.
But even with sample code from github (CameraXbasic) it is not working on the most recent Emulators for API 31 and API 32.
Is there any way to get this work?
2022-03-11 12:51:07.393 18491-18556/com.android.example.cameraxbasic E/CameraCaptureSession: Session 0: Exception while stopping repeating:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2350)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1277)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
at androidx.camera.camera2.internal.SynchronizedCaptureSessionBaseImpl.close(SynchronizedCaptureSessionBaseImpl.java:464)
at androidx.camera.camera2.internal.CaptureSession.release(CaptureSession.java:418)
at androidx.camera.camera2.internal.Camera2CameraImpl.releaseSession(Camera2CameraImpl.java:518)
at androidx.camera.camera2.internal.Camera2CameraImpl.resetCaptureSession(Camera2CameraImpl.java:1201)
at androidx.camera.camera2.internal.Camera2CameraImpl.closeCamera(Camera2CameraImpl.java:432)
at androidx.camera.camera2.internal.Camera2CameraImpl$StateCallback.reopenCameraAfterError(Camera2CameraImpl.java:1665)
at androidx.camera.camera2.internal.Camera2CameraImpl$StateCallback.handleErrorOnOpen(Camera2CameraImpl.java:1617)
at androidx.camera.camera2.internal.Camera2CameraImpl$StateCallback.onError(Camera2CameraImpl.java:1593)
at androidx.camera.camera2.internal.CameraDeviceStateCallbacks$ComboDeviceStateCallback.onError(CameraDeviceStateCallbacks.java:121)
at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1748)
at android.hardware.camera2.impl.CameraDeviceImpl.$r8$lambda$KBQCqQRdhVVn7uHI9Xdha6OqnsU(Unknown Source:0)
at android.hardware.camera2.impl.CameraDeviceImpl$$ExternalSyntheticLambda0.accept(Unknown Source:8)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:281)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$1.run(SequentialExecutor.java:111)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

Camera2 MediaRecorder - How to record in WebM format?

I want to record a video in WebM format with Camera2 and MediaRecorder.
To do this, I'm using the Camera2Video sample code on Github. The sample shows the way to record in mp4 format, using back or front camera.
The MediaRecorder configuration is done in a single method:
/** Creates a [MediaRecorder] instance using the provided [Surface] as input */
private fun createRecorder(surface: Surface) = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setVideoSource(MediaRecorder.VideoSource.SURFACE)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
setOutputFile(outputFile.absolutePath)
setVideoEncodingBitRate(RECORDER_VIDEO_BITRATE)
if (args.fps > 0) setVideoFrameRate(args.fps)
setVideoSize(args.width, args.height)
setVideoEncoder(MediaRecorder.VideoEncoder.H264)
setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
setInputSurface(surface)
}
And what I'm trying to do is to find a goof configuration to record in webm
private fun createRecorder(surface: Surface) = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setVideoSource(MediaRecorder.VideoSource.SURFACE)
setOutputFormat(MediaRecorder.OutputFormat.WEBM)
setOutputFile(outputFile.absolutePath)
setVideoEncodingBitRate(RECORDER_VIDEO_BITRATE)
if (args.fps > 0) setVideoFrameRate(args.fps)
setVideoSize(args.width, args.height)
setVideoEncoder(MediaRecorder.VideoEncoder.VP8)
setAudioEncoder(MediaRecorder.AudioEncoder.VORBIS)
setInputSurface(surface)
}
But, doing this, I'm facing a crash:
2020-12-09 14:59:26.560 28899-28899/com.android.example.camera2.video W/CameraDevice-JV-0: Stream configuration failed due to: endConfigure:543: Camera 0: Unsupported set of inputs/outputs provided
2020-12-09 14:59:26.564 28899-28899/com.android.example.camera2.video E/CameraCaptureSession: Session 0: Failed to create capture session; configuration failed
2020-12-09 14:59:26.566 28899-28945/com.android.example.camera2.video E/CameraFragment: Camera 0 session configuration failed
java.lang.RuntimeException: Camera 0 session configuration failed
at com.example.android.camera2.video.fragments.CameraFragment$createCaptureSession$$inlined$suspendCoroutine$lambda$1.onConfigureFailed(CameraFragment.kt:375)
at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.lambda$onConfigureFailed$1(CallbackProxies.java:64)
at android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$gvbTsp9UPpKJAbdycdci_ZW5BeI.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.os.HandlerThread.run(HandlerThread.java:65)
2020-12-09 14:59:26.607 28899-28899/com.android.example.camera2.video E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.example.camera2.video, PID: 28899
java.lang.RuntimeException: Camera 0 session configuration failed
at com.example.android.camera2.video.fragments.CameraFragment$createCaptureSession$$inlined$suspendCoroutine$lambda$1.onConfigureFailed(CameraFragment.kt:375)
at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.lambda$onConfigureFailed$1(CallbackProxies.java:64)
at android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$gvbTsp9UPpKJAbdycdci_ZW5BeI.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.os.HandlerThread.run(HandlerThread.java:65)
The first line tells me there is a misconfiguration
Stream configuration failed due to: endConfigure:543: Camera 0: Unsupported set of inputs/outputs provided
I tried to comment lines about audio source too because I see that Vorbis Encoder is not supported with the same results.
How can I record a video in WebM format ?

Flutter tflite plugin not doing recognitions in release version of app

I have been trying to use the flutter tflite plugin in my app and so far have been testing it in dev/debug where it is working i.e. when I run the following
var recognitions = await Tflite.runModelOnImage(
path: croppedFile.path, // required
imageMean: 0.0, // defaults to 117.0
imageStd: 255.0, // defaults to 1.0
numResults: 2, // defaults to 5
threshold: 0.2, // defaults to 0.1
asynch: true // defaults to true
);
it does give me back some recognitions. However when I make a release version of the same code it does not return any recognitions when run on the same device with same input data. I am making the release version using following steps:
//step 1
flutter build appbundle
// step 2
java -jar bundletool-all-1.3.0.jar build-apks --bundle=app-release.aab --output=app-release.apks --ks=key.jks --ks-pass= --ks-key-alias=key --key-pass=
// step 3
java -jar bundletool-all-1.3.0.jar install-apks --apks=app-release.apks
I have also added following in my android build.gradle
aaptOptions {
noCompress 'tflite'
noCompress 'lite'
}
How is it possible to get a different result in release whereas the same code works in debug version of app? What am I missing in my setup?
NOTE: I can only test this on Android
UPDATE
Digging further, I ran the app in profile mode and found following logs (Note: These only show up in profile mode so I am not sure how far it is from the release version. Also, I don't get these error when running in debug):
2020-11-08 20:04:34.623 4869-4940/com.flutterApp.gng I/flutter: PlatformException(Failed to run model, Attempt to invoke virtual method 'org.tensorflow.lite.Tensor org.tensorflow.lite.Interpreter.getInputTensor(int)' on a null object reference, java.lang.NullPointerException: Attempt to invoke virtual method 'org.tensorflow.lite.Tensor org.tensorflow.lite.Interpreter.getInputTensor(int)' on a null object reference
at sq.flutter.tflite.TflitePlugin.feedInputTensor(TflitePlugin.java:326)
at sq.flutter.tflite.TflitePlugin.feedInputTensorImage(TflitePlugin.java:371)
at sq.flutter.tflite.TflitePlugin$RunModelOnImage.<init>(TflitePlugin.java:477)
at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:102)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.Messag
...
2020-11-08 02:08:07.438 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.453 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.460 23087-23136/? I/qtaguid: Tagging socket 89 with tag 6b55000000000(439632) for uid -1 failed errno=-24
2020-11-08 02:08:07.460 23087-23136/? I/NetworkManagementSocketTagger: tagSocketFd(89, 439632, -1) failed with errno-24
2020-11-08 02:08:07.469 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.486 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.521 657-657/? I/chatty: uid=1000(system) /system/bin/surfaceflinger identical 2 lines
2020-11-08 02:08:07.540 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.542 22602-22654/com.flutterApp.gng I/flutter: Found 3 faces
2020-11-08 02:08:07.557 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.566 1449-2272/? W/StorageManager: getStorageLowBytes lowPercent : 5, lowBytes : 2861259366, maxLowBytes : 524288000
2020-11-08 02:08:07.577 22602-22654/com.flutterApp.gng I/flutter: PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
at sq.flutter.tflite.TflitePlugin$TfliteTask.<init>(TflitePlugin.java:427)
at sq.flutter.tflite.TflitePlugin$RunModelOnImage.<init>(TflitePlugin.java:465)
at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:102)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1
2020-11-08 02:08:07.588 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.608 22602-22654/com.flutterApp.gng I/flutter: PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
at sq.flutter.tflite.TflitePlugin$TfliteTask.<init>(TflitePlugin.java:427)
at sq.flutter.tflite.TflitePlugin$RunModelOnImage.<init>(TflitePlugin.java:465)
at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:102)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1
2020-11-08 02:08:07.622 657-657/? I/HWComposer: getActiveConfigs: Attempted to access invalid display -1
2020-11-08 02:08:07.641 22602-22654/com.flutterApp.gng I/flutter: PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
at sq.flutter.tflite.TflitePlugin$TfliteTask.<init>(TflitePlugin.java:427)
at sq.flutter.tflite.TflitePlugin$RunModelOnImage.<init>(TflitePlugin.java:465)
at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:102)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1
As I don't see the behavior in debug mode, I am still confused on what is going on in the app when running the release version.

android camera2 sample app android-Camera2Basic throws exception after first capture

I'm using the google sample app camera2basic (https://github.com/googlesamples/android-Camera2Basic) , but it throws exception after performing the first picture capture. I see the camera is closed, but how to fix it properly? I expected the google sample to show the proper lifecycle.
Here is the exception:
07-06 10:26:00.296 8066-8110/com.example.android.camera2basic I/RequestQueue﹕ Repeating capture request set.
07-06 10:26:00.571 8066-8111/com.example.android.camera2basic V/RenderScript﹕ 0x9e643200 Launching thread(s), CPUs 8
07-06 10:26:19.656 8066-8078/com.example.android.camera2basic W/CameraBase﹕ mediaserver's remote binder Camera object died
07-06 10:26:19.661 8066-8083/com.example.android.camera2basic W/CameraBase﹕ Camera service died!
07-06 10:26:19.661 8066-8144/com.example.android.camera2basic E/Camera﹕ Error 100
07-06 10:26:19.661 8066-8144/com.example.android.camera2basic E/RequestThread-0﹕ Received error 100 from the Camera1 ErrorCallback
07-06 10:26:19.661 8066-8144/com.example.android.camera2basic I/CameraDeviceState﹕ Legacy camera service transitioning to state ERROR
07-06 10:26:22.671 8066-8166/com.example.android.camera2basic E/RequestThread-0﹕ Hit timeout for jpeg callback!
07-06 10:26:22.671 8066-8166/com.example.android.camera2basic W/RequestHolder﹕ Capture failed for request: 3
07-06 10:26:22.671 8066-8166/com.example.android.camera2basic I/CameraDeviceState﹕ Legacy camera service transitioning to state CAPTURING
07-06 10:26:22.671 8066-8166/com.example.android.camera2basic E/CameraDeviceState﹕ Cannot call capture while in state: 0
07-06 10:26:22.681 8066-8166/com.example.android.camera2basic E/RequestThread-0﹕ Received device exception:
java.lang.RuntimeException: getParameters failed (empty parameters)
at android.hardware.Camera.native_getParameters(Native Method)
at android.hardware.Camera.getParameters(Camera.java:1953)
at android.hardware.camera2.legacy.RequestThreadManager$5.handleMessage(RequestThreadManager.java:807)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
07-06 10:26:22.781 8066-8066/com.example.android.camera2basic W/CameraCaptureSession﹕ Session 0: The camera device was already closed:
java.lang.IllegalStateException: CameraDevice was already closed
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:1482)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:677)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:328)
at com.example.android.camera2basic.Camera2BasicFragment.closeCamera(Camera2BasicFragment.java:560)
at com.example.android.camera2basic.Camera2BasicFragment.onPause(Camera2BasicFragment.java:468)
at android.app.Fragment.performPause(Fragment.java:2318)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:954)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
at android.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:1898)
at android.app.Activity.performPause(Activity.java:6366)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1308)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3647)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3620)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3595)
at android.app.ActivityThread.access$1100(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5834)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)

Categories

Resources