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

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)

Related

Android CameraX VideoRecorder error > Encoder cannot created : null

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)

I am using com.github.florent37:camerafragment:1.0.8. It woking fine in lollipop but not working in Nougat

I am using florent37:cameraFragment for custom camera. It working fine in lollipop but it is not working Nougat version. Please help me out. Thanks in advance
E/WVMExtractor: Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
03-29 12:41:47.722 3773-3863/com.camerasample I/OMXClient: MuxOMX ctor
03-29 12:41:47.914 3773-3836/com.camerasample I/MediaRecorderJNI: prepare: surface=0x98162800
03-29 12:41:48.115 3773-3836/com.camerasample E/MediaRecorder: start failed: -2147483648
03-29 12:41:48.115 3773-3836/com.camerasample E/AndroidRuntime: FATAL EXCEPTION: BaseCameraManager
Process: com.camerasample, PID: 3773
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.github.florent37.camerafragment.internal.manager.impl.Camera1Manager$4.run(Camera1Manager.java:192)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)

Android Wear App Crash in Moto 360 in other watches app is working fine

I am working on wear application. Application is working fine in other watches but in Moto 360 it is getting crashed as we launch application.
Android wear 1.5.0, OS: 6.0.1,Google Play service 11.0.55.
Here is the logs.
--------- beginning of crash
07-06 12:48:54.471 5752-5752/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.android.wearable.app, PID: 5752
java.lang.RuntimeException: Unable to destroy activity {com.google.android.wearable.app/com.google.android.clockwork.home.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getHeight()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3831)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3849)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4053)
at android.app.ActivityThread.-wrap15(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1350)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getHeight()' on a null object reference
at com.google.android.clockwork.home.cuecard.VoicePlateFragment.onCueCardClosed(VoicePlateFragment.java:1734)
at com.google.android.clockwork.home.cuecard.VoiceUiController.close(VoiceUiController.java:440)
at com.google.android.clockwork.home.HomeActivity.removeCueCard(HomeActivity.java:1720)
at com.google.android.clockwork.home.HomeActivity.destroyCueCard(HomeActivity.java:876)
at com.google.android.clockwork.home.HomeActivity.onDestroy(HomeActivity.java:908)
at android.app.Activity.performDestroy(Activity.java:6422)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1142)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3818)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3849) 
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4053) 
at android.app.ActivityThread.-wrap15(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1350) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5422) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
07-06 12:48:54.480 467-933/? W/ActivityManager: Force finishing activity com.google.android.wearable.app/com.google.android.clockwork.home.HomeActivity
07-06 12:48:54.745 467-508/? V/WindowManager: Layouts looping: On entry to LockedInner, mPendingLayoutChanges = 0x1
07-06 12:48:54.745 467-508/? V/WindowManager: Layouts looping: after finishPostLayoutPolicyLw, mPendingLayoutChanges = 0x0
07-06 12:48:54.746 467-508/? V/WindowManager: Layouts looping: mLayoutNeeded, mPendingLayoutChanges = 0x1
07-06 12:48:54.746 467-508/? V/WindowManager: Layouts looping: On entry to LockedInner, mPendingLayoutChanges = 0x1
07-06 12:48:54.747 467-508/? V/WindowManager: Layouts looping: after finishPostLayoutPolicyLw, mPendingLayoutChanges = 0x0
07-06 12:48:54.753 467-508/? V/WindowManager: Layouts looping: mLayoutNeeded, mPendingLayoutChanges = 0x1
07-06 12:48:54.754 467-508/? E/WindowManager: Performed 6 layouts in a row. Skipping
07-06 12:48:54.760 467-508/? I/ActivityManager: Displayed com.us.lexusenformremote/.Splash: +602ms
07-06 12:48:54.975 5359-5359/? I/CmaSystemUpdateService: ActiveReceiver: Intent { act=android.os.UpdateLock.UPDATE_LOCK_CHANGED flg=0x4000010 cmp=com.google.android.gms/.update.SystemUpdateServiceActiveReceiver (has extras) }
07-06 12:48:54.975 5359-5359/? I/CmaSystemUpdateService: receiver: Intent { act=android.os.UpdateLock.UPDATE_LOCK_CHANGED flg=0x4000010 cmp=com.google.android.gms/.update.SystemUpdateServiceActiveReceiver (has extras) }
07-06 12:48:55.004 213-5984/? D/hardware_info: hw_info_append_hw_type : device_name = voice-rec-dmic-ef-fluence
07-06 12:48:55.008 213-343/? D/audio_hw_primary: adev_close_input_stream: 0xb410f1e0
This issue has been opened in this google forum and the device was moto 360 as well. Here's the engineer's response:
There are many reasons why your Android Wear watch might show the
message “Android Wear has stopped”.
Make sure you are on the latest Android Wear app update.
Make sure you are on the latest Android Wear watch update
Try restarting your watch
If none of this works, then try unpairing and pairing again.
If none of this is not working, you might try other solutions users in
this thread used succesfully.
Go to Settings > Apps > Android Wear - Clear Cache and Clear Data. See if this helps.
Update Google app on your Android phone or iPhone
Check 3rd party apps and watch faces recently installed. Try uninstalling from phone and then reboot both watch and phone.
From Settings, Device, Apps, use the Uninstall updates button to back out the latest changes to Google Play Services, Then Clear cache
and Clear data. There could be a problem with the latest update of
Google play Services.
If you have problem with some specific manufacturer or you suspect it might be a Hardware issue, please contact them
Check steps on how to fix an app that is not working.

xamarin android camera throws stop face detection failed exception

I am starting a basic camera app using Android Intent.ActionImageCapture, StartActivityForResult() starts the camera app, but then it crashes even before capturing an image.
The Exception in logcat is java.lang.runtime Stop face detection failed.
I am not using face detection and have no need for it. And unable to handle this error.
So far this issue has occurred in 6.0.1, but works fine with versions lower and higher than 6.
This is the code:
Intent intent = new Intent(MediaStore.ActionImageCapture);
Java.IO.File _file = new Java.IO.File(m_cameraPhotosFolder, String.Format("mosaicfile_{0}.jpg", Guid.NewGuid()));
// Tell Camera where to save image
m_currentPhotoFileName = _file.AbsolutePath;
intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file));
StartActivityForResult(intent, 0);
Logcat:
V/CAM_PhotoModule( 8729): Close camera device.
E/CAM_AndroidCameraManagerImpl( 8729): Stopping face detection failed, ignoring.
E/CAM_AndroidCameraManagerImpl( 8729): java.lang.RuntimeException: stop face detection failed
E/CAM_AndroidCameraManagerImpl( 8729): at android.hardware.Camera._stopFaceDetection(Native Method)
E/CAM_AndroidCameraManagerImpl( 8729): at android.hardware.Camera.stopFaceDetection(Camera.java:1751)
E/CAM_AndroidCameraManagerImpl( 8729): at com.android.camera.AndroidCameraManagerImpl$CameraHandler.stopFaceDetection(SourceFile:138)
E/CAM_AndroidCameraManagerImpl( 8729): at com.android.camera.AndroidCameraManagerImpl$CameraHandler.handleMessage(SourceFile:337)
E/CAM_AndroidCameraManagerImpl( 8729): at android.os.Handler.dispatchMessage(Handler.java:102)
E/CAM_AndroidCameraManagerImpl( 8729): at android.os.Looper.loop(Looper.java:148)
E/CAM_AndroidCameraManagerImpl( 8729): at android.os.HandlerThread.run(HandlerThread.java:61)
I/MtkCam/Cam1Device( 307): (1057)(Default:0)[Cam1DeviceBase::stopPreview] +
I/MtkCam/CamAdapter( 307): (MtkZsd)[BaseCamAdapter::onImgBufProviderDestroyed] id=4, ImgBufProvider=0x0
W/MtkCam/CamClient/FDClient( 307): (1057)[stopFaceDetection] FD was not running
I/MtkCam/CamAdapter( 307): (MtkZsd)[BaseCamAdapter::onImgBufProviderDestroyed] id=5, ImgBufProvider=0x0
W/MtkCam/CamClient/OTClient( 307): (1057)[stopOT] OT was not running
I/MtkCam/Cam1Device( 307): (1057)(Default:0)[Cam1DeviceBase::stopPreview] -
I/MtkCam/DisplayClient( 307): [uninit] + getStrongCount(2)
I/MtkCam/CamAdapter( 307): (MtkZsd)[BaseCamAdapter::onImgBufProviderDestroyed] id=1, ImgBufProvider=0xd9eaba90

Any problems taking a portrait photo when device is in landscape?

I am making a rather specialist camera app for a device which is physically always going to be held in a landscape orientation. Part of the spec is that it must be able to preview and take photos in a portrait orientation - see image below.
I am having some trouble with a runtime exception "setParameters failed" (in response to a call to camera.setParameters()) and I just wanted to check here whether there was some fundamental problem that you think I might be up against. For example perhaps the light sensors on the back of the camera are a arranged in a rectangle and physically this can not be achieved - or perhaps some other unavoidable issue. (By the way I have been informed that the light sensors should be arranged in a square, so this problem will not occur - but my sources may be mistaken). Maybe this is hardware dependant?
EDIT: FYI my crash log is below:
D/AndroidRuntime(7210): Shutting down VM
W/dalvikvm(7210): threadid=1: thread exiting with uncaught exception (group=0x415c2d88)
E/AndroidRuntime(7210): FATAL EXCEPTION: main
E/AndroidRuntime(7210): Process: com.rai.motion, PID: 7210
E/AndroidRuntime(7210): java.lang.RuntimeException: Unable to resume activity {com.rai.motion/com.rai.motion.MotionMain}: java.lang.RuntimeException: setParameters failed
E/AndroidRuntime(7210): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2850)
E/AndroidRuntime(7210): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2879)
E/AndroidRuntime(7210): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2303)
E/AndroidRuntime(7210): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime(7210): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
E/AndroidRuntime(7210): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(7210): at android.os.Looper.loop(Looper.java:212)
E/AndroidRuntime(7210): at android.app.ActivityThread.main(ActivityThread.java:5151)
E/AndroidRuntime(7210): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(7210): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(7210): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
E/AndroidRuntime(7210): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime(7210): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(7210): Caused by: java.lang.RuntimeException: setParameters failed
E/AndroidRuntime(7210): at android.hardware.Camera.native_setParameters(Native Method)
E/AndroidRuntime(7210): at android.hardware.Camera.setParameters(Camera.java:1689)
E/AndroidRuntime(7210): at com.rai.motion.MotionMain.change_java_recording_camera_settings(MotionMain.java:2105)
E/AndroidRuntime(7210): at com.rai.motion.MotionMain.start_recording_camera(MotionMain.java:2154)
E/AndroidRuntime(7210): at com.rai.motion.MotionMain.onResume(MotionMain.java:6013)
E/AndroidRuntime(7210): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
E/AndroidRuntime(7210): at android.app.Activity.performResume(Activity.java:5310)
E/AndroidRuntime(7210): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2840)
E/AndroidRuntime(7210): ... 12 more
I/Process(7210): Sending signal. PID: 7210 SIG: 9
I made a small camera test app a while ago. It was no problem, to show the camera preview in portrait mode, whilst the device was in landscape orientation. It was tricky to rotate the camera image by the right angle (because this rotation angle is device/camera dependant). A problem however was, that the perspective didn't match then: object seemed to be fatter or streched. But to find out the recalculating algorithm shouldn't take to much time on Stackoverflow.
So regarding
I just wanted to check here whether there was some fundamental problem
that you think I might be up against.
[...]and physically this can not be achieved - or perhaps some other unavoidable issue.
the answer is: it's a doable task. Your exception probably has a totally different reason.

Categories

Resources