This is likely an advanced question since I have a a fair bit of experience with developing camera apps for Android and have the basics right. On some phones, when calling
Camera.open(0);
I get a RuntimeException. My camera app works on most phones (1000+ device types of Android) but fails on a few (about 50+ device types). It also appears to be inconsistent across devices meaning the app will always work or fail on the same model of the device. E.g. the app works on some Galaxy S2's but fails on other S2's.
I have couple of logcats:
On Android 4.0.4
05-26 12:22:26.150 I/CameraService( 85): Opening camera 0<br/>
05-26 12:22:26.150 I/NvOmxCamera( 85): HAL_camera_device_open: open camera 0<br/>
05-26 12:22:26.150 D/NvOmxCamera( 85): HAL_openCameraHardware() use_camera_1st_source=1<br/>
05-26 12:22:26.150 E/NvOmxCamera( 85): Invalid camera ID 0, hardware does not support simultaneous CSI camera use<br/>
05-26 12:22:26.150 E/CameraService( 85): Could not open camera 0: -38<br/>
05-26 12:22:26.150 I/CameraService( 85): Destroying camera 0<br/>
05-26 12:22:26.160 D/AndroidRuntime(25895): Shutting down VM<br/>
05-26 12:22:26.160 W/dalvikvm(25895): threadid=1: thread exiting with uncaught exception (group=0x40a5a1f8)<br/>
05-26 12:22:26.180 E/Crittercism(25895): java.lang.RuntimeException: Fail to connect to camera service<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.native_setup(Native Method)<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.<init>(Camera.java:304)<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.open(Camera.java:264)<br/>
On Android 2.3.6
05-26 11:27:16.984 W/CameraSwitch( 7088): open main camera<br/>
05-26 11:27:16.984 W/CameraSwitch( 7088): no file - can't switch camera<br/>
05-26 11:27:16.994 D/CameraService( 66): CameraService::connect E (pid 7088, client 0xad08)<br/>
05-26 11:27:16.994 D/CameraService( 66): CameraService::connect X (pid 7088, new client 0xad08) rejected. (old pid 7173, old client 0x3ca30)<br/>
05-26 11:27:16.994 D/CameraService( 66): The old client is dead!<br/>
05-26 11:27:16.994 D/AndroidRuntime( 7088): Shutting down VM<br/>
05-26 11:27:16.994 W/dalvikvm( 7088): threadid=1: thread exiting with uncaught exception (group=0x400259f8)<br/>
05-26 11:27:17.094 D/dalvikvm( 7088): GC_FOR_MALLOC freed 15803 objects / 957392 bytes in 93ms<br/>
05-26 11:27:17.114 E/Crittercism( 7088): java.lang.RuntimeException: Fail to connect to camera service<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.native_setup(Native Method)<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.<init>(Camera.java:118)<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.open(Camera.java:91)
<br/>
I have tried a lot of things but I just cannot figure out what the problem is. This line of code is one of the first lines to execute (Camera.open()) so it is unlikely the error is in my code. Any insight as to why this line fails on some cameras will be very helpful.
If it is relevant, I am opening the camera from a service. I can post any information that is needed to diagnose this problem. Thanks.
do you include camera permissions and features in your app?
if yes, maybe the camera is in use in another app.
from android developers:
"Throws RuntimeException if opening the camera fails (for example, if the camera is in use by another process or device policy manager has disabled the camera)."
Related
This just started happening recently and it has gotten progressively worse. I was initially alerted when I saw a couple calls to the Facebook API when my app had nothing to do with FB whatsoever.
Things I tried that (temporarily) helped:
- Closing all tabs in Chrome
- Closing all open applications
- Selecting "Show only selected application" option
Note. My app isn't even running. This happens as soon as I open Android Studio and plug my phone in. I get roughly 1,000 log/30 minutes.
Example 1
Example 2
08-11 13:08:53.087 2099-2099/? I/wpa_supplicant: RRM: Ignoring radio measurement request: Not RRM network
08-11 13:08:53.566 1626-1626/? D/HeadsetPhoneState: sendDeviceStateChanged. mService=1 mIsSimStateLoaded=true mSignal=2 mRoam=0 mBatteryCharge=4
08-11 13:08:55.629 1105-1142/? I/WifiService: requestActivityInfo uid=1000
08-11 13:08:55.630 1105-1142/? I/WifiService: reportActivityInfo uid=1000
getSupportedFeatures uid=1000
08-11 13:08:55.636 1954-1954/? E/QtiImsExtUtils: getConfigForPhoneId phoneId is invalid
isCarrierConfigEnabled bundle is null
08-11 13:09:12.433 2453-2453/? I/clatd: Detecting NAT64 prefix from DNS...
08-11 13:09:12.658 1751-1789/? I/QcrilOemhookMsgTunnel: [0]processOemHookIndication length=21
08-11 13:09:12.659 1751-1751/? D/QcrilMsgTunnelIfaceManager: handleMessage what = 0
08-11 13:09:12.665 15401-15415/? V/QMI_OEMHOOK: Thread=ModemService received { when=0 what=0 obj=android.os.AsyncResult#862fe81 target=com.qualcomm.qcrilhook.QmiOemHook }
08-11 13:05:00.210 2554-2554/? I/BeaconBle: Starting scan on OS scanner. BT state: 12
08-11 13:05:00.212 2554-2554/? D/BluetoothAdapter: isLeEnabled(): ON
08-11 13:05:00.214 1105-1795/? I/ActivityManager: Start proc 25103:com.cvs.launchers.cvs/u0a161 for broadcast com.cvs.launchers.cvs/com.ibm.mce.sdk.wi.AlarmReceiver
08-11 13:05:00.215 1105-1541/? D/RecurrenceRule: Resolving using anchor 2018-08-11T13:05:00.215-04:00[America/New_York]
08-11 13:05:00.217 1626-2168/? I/bt_stack: [INFO:gatt_api.cc(1004)] GATT_Register
[INFO:gatt_api.cc(1027)] allocated gatt_if=5
08-11 13:05:00.218 2554-18778/? D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=5 mScannerId=0
08-11 13:05:00.221 1105-1541/? D/RecurrenceRule: Cycle 18 from 2018-07-19T00:00-04:00[America/New_York] to 2018-08-19T00:00-04:00[America/New_York]
08-11 13:05:00.222 1105-1541/? D/NetworkStats: Resolving plan for NetworkTemplate: matchRule=MOBILE_ALL, subscriberId=311480..., matchSubscriberIds=[311480...]
Your selecected filter Show only selected application will only work if a process is selected. Just select your process when your app is running where it currently says No Debuggable Processes.
The output shown in your screenshot is the log of the whole device, including logs of the system and other apps.
Logcat shows logs in general, so if you want to see just specific app, you got app filter above the list. Also theres text filter if given app is too noisy as well
Its on an HTC Aria, running 2.2 (API 8)
https://en.wikipedia.org/wiki/HTC_Aria
The aria is an armv6 device that supports opengles 2
If you open up the latest Android Studio (im working on windows 7), then import the HelloGL2 sample, then simply try to run it on the above device, it will fail as soon as it tries to make a call into the native library.
Here is the log:
01-06 11:14:08.467 12771-12813/com.android.gl2jni D/dalvikvm: Trying to load lib /data/data/com.android.gl2jni/lib/libgl2jni.so 0x44c165d0
01-06 11:14:08.467 12771-12813/com.android.gl2jni I/dalvikvm: Unable to dlopen(/data/data/com.android.gl2jni/lib/libgl2jni.so): Cannot load library: link_image[1995]: failed to link libgl2jni.so
01-06 11:14:08.477 12771-12813/com.android.gl2jni W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/android/gl2jni/GL2JNILib;.<clinit>
01-06 11:14:08.497 12771-12813/com.android.gl2jni W/dalvikvm: threadid=8: thread exiting with uncaught exception (group=0x40028a00)
01-06 11:14:08.517 95-121/? I/ActivityManager: Displayed activity com.android.gl2jni/.GL2JNIActivity: 9823 ms (total 2027818 ms)
01-06 11:14:08.567 12771-12813/com.android.gl2jni E/AndroidRuntime: FATAL EXCEPTION: GLThread 9
java.lang.ExceptionInInitializerError
at com.android.gl2jni.GL2JNIView$Renderer.onSurfaceChanged(GL2JNIView.java:332)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1327)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
Caused by: java.lang.UnsatisfiedLinkError: Library gl2jni not found
at java.lang.Runtime.loadLibrary(Runtime.java:461)
at java.lang.System.loadLibrary(System.java:557)
at com.android.gl2jni.GL2JNILib.<clinit>(GL2JNILib.java:24)
at com.android.gl2jni.GL2JNIView$Renderer.onSurfaceChanged(GL2JNIView.java:332)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1327)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
01-06 11:14:08.607 95-164/? W/ActivityManager: Force finishing activity com.android.gl2jni/.GL2JNIActivity
This sample works on the 3 other devices i've tried (Galaxy s5, Galaxy J1, Nexus s)
The line: 'Unable to dlopen(/data/data/com.android.gl2jni/lib/libgl2jni.so): Cannot load library: link_image[1995]: failed to link libgl2jni.so' is probably key. I tried loading the library explicitly using system.loadlibrary, but the same problem happens on that call.
I think it might be something to do with the processor being armv6?
The sample is configured to do 'armeabi' though.
I'm trying to capture an image from the back camera using the Android Camera API.
I'm using this code, 4. Tutorial: Using the camera API. It works when it uses the front camera. When I change CAMERA_FACING_FRONT to CAMERA_FACING_BACK, I get the Error 100 on
camera.takePicture(null, null, new PhotoHandler(getApplicationContext()));
I'm using Samsung Galaxy S3. Anyone knows how to solve this? It has been asked a multiple times, but I haven't found a real solution anywhere.
Edit: Full log until Error 100
No exceptions in the program itself, error log:
03-19 01:57:43.069 2348-7984/? E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
03-19 01:57:57.874 2348-2689/? E/Watchdog﹕ !#Sync 13376
03-19 01:57:59.734 18504-18557/? A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 18557 (pictureThread)
03-19 01:58:01.984 22720-22720/? E/ctxmgr﹕ [PowerConnectionProducer]Could not write powerInfo=Plug state: 2 BatteryLevel: 0.98, status=Status{statusCode=unknown status code: 7503, resolution=null}
03-19 01:58:07.239 18489-18489/com.example.luka.udpklijentandroid E/Camera﹕ Error 100
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 23.29: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 24.32: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 25.31: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 26.40: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 27.28: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 28.35: This output device support only one mic
03-19 01:58:08.734 2348-2565/? E/AudioService﹕ Media server died.
03-19 01:58:08.734 2348-2565/? E/AudioService﹕ Media server started.
03-19 01:58:27.879 2348-2689/? E/Watchdog﹕ !#Sync 13377
The Facebook app (and Messenger) app crashes on Android Genymotion Emulator on OS X v10.10.3. Other apps that I have installed till now, run flawlessly without any error. Here is the logcat generated when the app starts (& crashes),
03-14 21:20:25.351 516-721/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.facebook.katana cmp=com.facebook.katana/.LoginActivity} from pid 1752
03-14 21:20:25.591 516-674/system_process I/ActivityManager﹕ Start proc com.facebook.katana:nodex for activity com.facebook.katana/.LoginActivity: pid=3031 uid=10078 gids={50078, 1028, 1015, 3003}
03-14 21:20:25.647 3031-3031/? E/dalvikvm﹕ Could not find class 'com.facebook.katana.app.WallpaperFacebookApplicationImpl', referenced from method com.facebook.katana.app.FacebookApplication.a
03-14 21:20:25.659 3031-3031/? D/CatchMeIfYouCan﹕ Process (nodex) ca: '/data/data/com.facebook.katana/app_cmiyc/902B45094161489D3AB6470A02B22D0D4A228C3001'
03-14 21:20:25.659 3031-3031/? D/CatchMeIfYouCan﹕ Process (nodex) fc: '/data/data/com.facebook.katana/app_cmiyc/902B45094161489D3AB6470A02B22D0D4A228C3002'
03-14 21:20:25.659 3031-3031/? D/ACRA﹕ ACRA is enabled for com.facebook.katana, intializing...
03-14 21:20:25.663 3031-3031/? D/ACRA﹕ Looking for error files in /data/data/com.facebook.katana/app_acra-reports
03-14 21:20:25.663 3031-3031/? D/ACRA﹕ Looking for error files in /data/data/com.facebook.katana/app_minidumps
03-14 21:20:25.667 3031-3031/? D/dalvikvm﹕ Trying to load lib /data/app-lib/com.facebook.katana-2/libgnustl_shared.so 0xa50c1508
03-14 21:20:25.807 144-144/? I/DEBUG﹕ pid: 3031, tid: 3031, name: ok.katana:nodex >>> com.facebook.katana:nodex <<<
03-14 21:20:26.075 516-3049/system_process W/ActivityManager﹕ Force finishing activity com.facebook.katana/.LoginActivity
03-14 21:20:26.611 516-726/system_process I/ActivityManager﹕ Process com.facebook.katana:nodex (pid 3031) has died.
The specific error is,
21:20:25.647 3031-3031/? E/dalvikvm﹕ Could not find class 'com.facebook.katana.app.WallpaperFacebookApplicationImpl', referenced from method com.facebook.katana.app.FacebookApplication.a
Has anybody fixed the problem?
As far right now, I am using the Google 4.3 in the Virtual Machine, and Facebook app (& messenger) work fine. I will wait the bug to be fixed.
I am trying to run the simplest Hello World example app and looks like I can crash it even all it does is showing a TextView.
Steps to reproduce: Launch it in the emulator (1.5). Open the app - it shows the text view, then lock the phone by pressing "end call" button. Unlock by pressing "menu", then press "back". App crashes with "The process android.process.acore has stopped unexpectedly..." and Force Close button. It does not happen all the time, but I am able to reproduce it every time after wiping the user data at least.
I wonder if default Hello World is missing a detail which was considered too advanced for a hello world... Such problems with a basic example does not look very encouraging =)
Any idea what detail is missing and how to avoid this crash?
Stack (I've truncated timestamps):
37.478: DEBUG/KeyguardViewMediator(576): wakeWhenReadyLocked(82)
37.481: DEBUG/KeyguardViewMediator(576): handleWakeWhenReady(82)
37.481: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.110: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.140: WARN/InputManagerService(576): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#436e3fc0
40.990: ERROR/IMemory(679): binder=0x238aa8 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
40.990: ERROR/IMemory(679): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
40.990: ERROR/IMemory(679): cannot map BpMemoryHeap (binder=0x238aa8), size=0, fd=-1 (Bad file number)
40.990: ERROR/Surface(679): Couldn't map Surface's heap (binder=0x238aa8, heap=0x238b00)
40.990: DEBUG/AndroidRuntime(679): Shutting down VM
40.990: WARN/dalvikvm(679): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
40.990: ERROR/AndroidRuntime(679): Uncaught handler: thread main exiting due to uncaught exception
40.990: ERROR/AndroidRuntime(679): java.lang.IllegalArgumentException
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvasNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvas(Surface.java:196)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.draw(ViewRoot.java:1175)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
40.990: ERROR/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99)
40.990: ERROR/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:123)
40.990: ERROR/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:3948)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:521)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
40.990: ERROR/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)
41.000: INFO/Process(576): Sending signal. PID: 679 SIG: 3
41.000: INFO/dalvikvm(679): threadid=7: reacting to signal 3
41.030: ERROR/ActivityThread(576): Failed to find provider info for android.server.checkin
41.030: ERROR/Checkin(576): Error reporting crash: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/crashes
41.070: INFO/dalvikvm(679): Wrote stack trace to '/data/anr/traces.txt'
50.940: WARN/ActivityManager(576): Launch timeout has expired, giving up wake lock!
50.980: WARN/ActivityManager(576): Activity idle timeout for HistoryRecord{4366ac40 {com.android.launcher/com.android.launcher.Launcher}}
sounds to me more like something wrong with your emulator. Why dont you delete your emulator and create a new one and try again with a fresh project.
Hope that will help you. BTW why are you using emulator on 1.5?? Start to build applications for min 2.1.
Good luck.