I am using Android 2.2 (API Level 8). The camera is enabled in the manifest. When I try the camera icon provided by the emulator model, it runs for a few seconds showing a gray box moving around a black and white checkerboard, then dies with the error message:
Sorry! The application Camera (process
com.android.camera) has stopped
unexpectedly. Please try again.
Trying again, of course, doesn't help. I am using the provided emulator camera to compare behavior with a camera application I am working on. Why does the android emulator camera stop unexpectedly?
The emulator camera is flaky at best.
To get more details run "platform-tools/adb logcat" from the host command line. The base problem seems to be the camera thinking there are multiple clients connected. The camera also sets the rotation to landscape but after crashing fails to set it back:
I/ActivityManager( 70): Starting: Intent { act=android.media.action.IMAGE_CAPTURE cmp=com.android.camera/.Camera } from pid 875
I/ActivityManager( 70): Start proc com.android.camera for activity com.android.camera/.Camera: pid=888 uid=10031 gids={1006, 1015}
I/WindowManager( 70): Setting rotation to 1, animFlags=1
I/ActivityManager( 70): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=22}
V/CameraHolder( 888): open camera 0
W/CameraService( 34): CameraService::connect X (pid 888) rejected (existing client).
E/CameraHolder( 888): fail to connect Camera
E/CameraHolder( 888): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 888): at android.hardware.Camera.native_setup(Native Method)
E/CameraHolder( 888): at android.hardware.Camera.<init>(Camera.java:258)
E/CameraHolder( 888): at android.hardware.Camera.open(Camera.java:220)
E/CameraHolder( 888): at com.android.camera.CameraHolder.open(CameraHolder.java:124)
E/CameraHolder( 888): at com.android.camera.Camera.ensureCameraDevice(Camera.java:1608)
E/CameraHolder( 888): at com.android.camera.Camera.startPreview(Camera.java:1660)
E/CameraHolder( 888): at com.android.camera.Camera.access$5500(Camera.java:95)
E/CameraHolder( 888): at com.android.camera.Camera$3.run(Camera.java:908)
E/CameraHolder( 888): at java.lang.Thread.run(Thread.java:1019)
W/dalvikvm( 888): threadid=11: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 888): FATAL EXCEPTION: Thread-12
See also question "4799183"
I would imagine because the emulator doesn't have a real camera, the hardware is simulated by the checkerbox you speak of. Because there is no hardware driver for real it most likely tries to check for capabilities, or set features that can't be done because the simulated hardware doesn't support it. Your best bet it to debug the camera or compile it yourself and add some debug output to find out what exactly is going on.
Does it work in 2.1 and earlier?
In the DDMS perspective I can see the exception shown here:
Emulator's camera built-in app buggy in Froyo / 2.2?
although I haven't tried the code change suggested in the article.
It might just be that the emulator camera is flaky :)
I have realized that camera simulation on the Emulator is stable on the API level 4 (Android 1.6) and below without crashing.
Related
I have launched an app on play store but it is crashing on several devices & I am not able test my app on every devices. i have crashlytics report
Crashlytics Report
Stack Trace
Fatal Exception: java.lang.RuntimeException: Internal error in Cloud Firestore (23.0.1).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:19)
at com.google.firebase.firestore.util.-$$Lambda$AsyncQueue$jx84dqgUsF4ojecSMurRqFLFD1Y.run(-.java:2)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
Caused by java.lang.RuntimeException: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:14)
at com.google.firebase.firestore.util.-$$Lambda$AsyncQueue$SynchronizedShutdownAwareExecutor$pKSAgg-ozJ8RbUveSl-44aUfFQw.run(-.java:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:15)
at java.lang.Thread.run(Thread.java:764)
Caused by android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY)
at android.database.sqlite.SQLiteConnection.nativeExecute(SQLiteConnection.java)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:578)
at android.database.sqlite.SQLiteSession.beginTransactionUnchecked(SQLiteSession.java:323)
at android.database.sqlite.SQLiteSession.beginTransaction(SQLiteSession.java:298)
at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:553)
at android.database.sqlite.SQLiteDatabase.beginTransactionWithListener(SQLiteDatabase.java:517)
at com.google.firebase.firestore.local.SQLitePersistence.runTransaction(SQLitePersistence.java:17)
at com.google.firebase.firestore.local.LocalStore.startMutationQueue(LocalStore.java:9)
at com.google.firebase.firestore.local.LocalStore.start(LocalStore.java)
at com.google.firebase.firestore.core.ComponentProvider.initialize(ComponentProvider.java:41)
at com.google.firebase.firestore.core.FirestoreClient.initialize(FirestoreClient.java:65)
at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0(FirestoreClient.java:10)
at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0$FirestoreClient(FirestoreClient.java)
at com.google.firebase.firestore.core.-$$Lambda$FirestoreClient$Eq-cAcb1C1mM4tyiJsLJXZ13tyU.run(-.java:8)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java)
at com.google.firebase.firestore.util.-$$Lambda$AsyncQueue$Y9GO7zO2DX6MzQJ5TbKtKW_NzO0.call(-.java:2)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java)
at com.google.firebase.firestore.util.-$$Lambda$AsyncQueue$SynchronizedShutdownAwareExecutor$pKSAgg-ozJ8RbUveSl-44aUfFQw.run(-.java:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:15)
at java.lang.Thread.run(Thread.java:764)
Device Information
Brand:OPPO
Model:
Orientation: Portrait
RAM free: 3.28 GB
Disk free: 95.39 GB
Date: 26-07-2021
Operating System
Version:9
Orientation: Portrait
Rooted:No
Other devices with same issue
Oppo: F17 Pro,CPH1853
Realme: 5i,c12,8pro
vivo: 1920,1803
My take on this is that an sqlite query is being executed on an sqlite connection that is already processing a query based on the fact that it is executing side a threaded background worker. it is possible that the system sqlite on this system may be compiled differently such as being in single threaded mode
the cause of this looks to be the firebase library and how it operates and if this is a systems issue (android on the oppo and the provided sqlite) then you may have to detect how it was compiled or bundle a verison of sqlite to work around this
it should be possible to dump the compile options of sqlite via an sql conenction and compare this to a knwn
My java application makes a bluetooth server and waits for connection.My program works fine in windows.
but when I try to run it in Linux it gives this error.How can I resolve this?
BlueCove version 2.1.1-SNAPSHOT on bluez
javax.bluetooth.BluetoothStateException: Bluetooth Device is not ready. [1] Operation not permitted
at com.intel.bluetooth.BluetoothStackBlueZ.nativeSetLocalDeviceDiscoverable(Native Method)
at com.intel.bluetooth.BluetoothStackBlueZ.setLocalDeviceDiscoverable(BluetoothStackBlueZ.java:307)
at javax.bluetooth.LocalDevice.setDiscoverable(LocalDevice.java:206)
at bluetoothjava.WaitThread.waitForConnection(WaitThread.java:32)
at bluetoothjava.WaitThread.run(WaitThread.java:18)
at java.base/java.lang.Thread.run(Thread.java:834)
BlueCove stack shutdown completed
I am having trouble with connecting to facebook login/register in my android studio project I have configured all the things provided from facebook,opening up the logcat I get this kind of error when trying to register/Sign in to the app (using Facebook Login and Register system from browser works when facebook is not installed but when trying to login/register from the app doesn't work and throws the logcat bellow) any help would be great as I am stuck with this for 2 days.
2019-08-31 15:20:21.315 3318-3393/? E/BufferQueueProducer: [com.prototype.mk/com.facebook.FacebookActivity[5278]#0] disconnect: not connected (req=1)
2019-08-31 15:20:21.503 3723-3818/? E/WindowManager: win=Window{8cb214b u0 com.prototype.mk/com.facebook.FacebookActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:870 com.android.server.wm.AppWindowToken.destroySurfaces:851 com.android.server.wm.WindowState.onExitAnimationDone:5414 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:2394 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2
I am trying to connect a USB Camera with an OTG cable on my Android app and for this purpose I use the UVCCamera repo. All the samples and my app work fine on most devices I have tested, but not on a Motorola E4 (on which I specifically need to run the app).
What I have noticed is that the UsbDevice is detached right after I grant permission to use it, and then is reattached as a new device. If I don't check if this happens I get a NullPointerException as the connection to the device is null when trying to get raw descriptors.
Here are the error messages I get:
E/UsbManager: exception in UsbManager.openDevice
java.lang.IllegalArgumentException: device /dev/bus/usb/001/008 does not exist or is restricted
at android.os.Parcel.readException(Parcel.java:1688)
at android.os.Parcel.readException(Parcel.java:1637)
at android.hardware.usb.IUsbManager$Stub$Proxy.openDevice(IUsbManager.java:443)
at android.hardware.usb.UsbManager.openDevice(UsbManager.java:353)
at com.serenegiant.usb.USBMonitor$UsbControlBlock.<init>(USBMonitor.java:1011)
at com.serenegiant.usb.USBMonitor$UsbControlBlock.clone(USBMonitor.java:1034)
at com.serenegiant.usb.UVCCamera.open(UVCCamera.java:192)
at com.serenegiant.usbcameracommon.AbstractUVCCameraHandler$CameraThread.handleOpen(AbstractUVCCameraHandler.java:444)
at com.serenegiant.usbcameracommon.AbstractUVCCameraHandler.handleMessage(AbstractUVCCameraHandler.java:300)
at com.serenegiant.usbcameracommon.UVCCameraHandler.handleMessage(UVCCameraHandler.java:31)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at com.serenegiant.usbcameracommon.AbstractUVCCameraHandler$CameraThread.run(AbstractUVCCameraHandler.java:747)
12-07 16:08:36.074 20866-20883/com.serenegiant.usbcameratest E/AndroidRuntime: FATAL EXCEPTION: USBMonitor Process: com.serenegiant.usbcameratest, PID: 20866 java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] android.hardware.usb.UsbDeviceConnection.getRawDescriptors()' on a null object reference
at com.serenegiant.usb.USBMonitor.updateDeviceInfo(USBMonitor.java:900)
at com.serenegiant.usb.USBMonitor$UsbControlBlock.<init>(USBMonitor.java:974)
t com.serenegiant.usb.USBMonitor$UsbControlBlock.<init>(USBMonitor.java:0)
at com.serenegiant.usb.USBMonitor$3.run(USBMonitor.java:563)
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)
Other applications on Google Play that use the same library to connect USB cameras work fine on the Motorola E4 too.
I have also posted the issue on github some time ago but have not got any answers.
I am new to android development, and have run into a problem I seem unable to solve.
My android app should be able to communicate with my arduino device, sending info
to and retrieving info from my device. I have set up my connection between the two
with a bluetooth device and I am using amarino to facilitate the communication.
Now I can connect with amarino and send data and receive data, now I want to do this from
my app. The problem comes when I enter this line:
private static final String DEVICE_ADDRESS = "07:12:04:16:68:18";
Amarino.connect(this, DEVICE_ADDRESS);
The number is the MAC address of my bluetooth adapter connected to my arduino device.
As soon as I run my app on my phone it just force closes due to unexpected error.
Now as I said, I am a bit of a noob when it comes to android, so I installed logCat to try get some log info out of it. All I got from it was this somewhat unhelpful error message:
com.example.projectgreetv3/.StartingPlace
10-24 15:22:55.140 E/AndroidRuntime(4906): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.projectgreetv3/com.example.projectgreetv3.StartingPlace}: java.lang.ClassNotFoundException: com.example.projectgreetv3.StartingPlace in loader dalvik.system.PathClassLoader[/data/app/com.example.projectgreetv3-1.apk]
10-24 15:22:55.140 E/AndroidRuntime(4906): Caused by: java.lang.ClassNotFoundException: com.example.projectgreetv3.StartingPlace in loader dalvik.system.PathClassLoader[/data/app/com.example.projectgreetv3-1.apk]
10-24 15:22:55.148 W/ActivityManager(539): Force finishing activity com.example.projectgreetv3/.StartingPlace
10-24 15:21:51.726 I/UinboxLogger(4585): [UinboxReceiver] onReceive() >> intent.getData() : com.example.projectgreetv3
10-24 15:21:52.382 I/UninstallAppProgress(4575): Finished uninstalling pkg: com.example.projectgreetv3
10-24 15:22:52.523 D/PackageManager(539): Scanning package com.example.projectgreetv3
I hope someone can help me with this, as I am on wits end.
For more info on:
- Arduino:
- http://www.arduino.cc/
- Amarino:
http://www.amarino-toolkit.net/
If you look a bit further down on your stacktrace (in the logcat) you will probably see that the cause of this crash is an NetworkOnMainThreadException. (If you are running Android 3.0 or higher)
Please make sure that you do all your network communication on a separate thread (Thread/ASyncTask).
http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html