Friends
I am facing this issue since so long but i am able to get any kind of solution to get working camera in emulator. I have gone through all the answer of the SO but none helped me uptill now.
If i create any emulator with any api but in none of my emulator camera application does not work. So i am not able to test any of the application which contains camera functionality. I guess may be its happening because of the hardware configuration of my system. But i am not sure about it.
I do not know why this issue occurs. Please help me to solve and find out the reason for the issue.
Here is the error which i get whenever i starts camera in emulator.
12-21 00:04:58.100: E/CameraService(55): CameraService::connect X (pid 2604) rejected (invalid cameraId 0).
12-21 00:04:58.110: W/CameraBase(2604): An error occurred while connecting to camera: 0
12-21 00:04:58.110: E/CameraHolder(2604): fail to connect Camera
12-21 00:04:58.110: E/CameraHolder(2604): java.lang.RuntimeException: Fail to connect to camera service
12-21 00:04:58.110: E/CameraHolder(2604): at android.hardware.Camera.native_setup(Native Method)
12-21 00:04:58.110: E/CameraHolder(2604): at android.hardware.Camera.<init>(Camera.java:350)
12-21 00:04:58.110: E/CameraHolder(2604): at android.hardware.Camera.open(Camera.java:309)
12-21 00:04:58.110: E/CameraHolder(2604): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
12-21 00:04:58.110: E/CameraHolder(2604): at com.android.camera.Util.openCamera(Util.java:267)
12-21 00:04:58.110: E/CameraHolder(2604): at com.android.camera.Camera$4.run(Camera.java:1100)
12-21 00:04:58.110: E/CameraHolder(2604): at java.lang.Thread.run(Thread.java:841)
12-21 00:04:58.110: W/dalvikvm(2604): threadid=11: thread exiting with uncaught exception (group=0xb4a29b90)
12-21 00:04:58.120: E/AndroidRuntime(2604): FATAL EXCEPTION: Thread-117
12-21 00:04:58.120: E/AndroidRuntime(2604): Process: com.android.camera, PID: 2604
12-21 00:04:58.120: E/AndroidRuntime(2604): java.lang.RuntimeException: openCamera failed
12-21 00:04:58.120: E/AndroidRuntime(2604): at com.android.camera.Util.openCamera(Util.java:272)
12-21 00:04:58.120: E/AndroidRuntime(2604): at com.android.camera.Camera$4.run(Camera.java:1100)
12-21 00:04:58.120: E/AndroidRuntime(2604): at java.lang.Thread.run(Thread.java:841)
12-21 00:04:58.120: E/AndroidRuntime(2604): Caused by: com.android.camera.CameraHardwareException: java.lang.RuntimeException: Fail to connect to camera service
12-21 00:04:58.120: E/AndroidRuntime(2604): at com.android.camera.CameraHolder.open(CameraHolder.java:135)
12-21 00:04:58.120: E/AndroidRuntime(2604): at com.android.camera.Util.openCamera(Util.java:267)
12-21 00:04:58.120: E/AndroidRuntime(2604): ... 2 more
12-21 00:04:58.120: E/AndroidRuntime(2604): Caused by: java.lang.RuntimeException: Fail to connect to camera service
12-21 00:04:58.120: E/AndroidRuntime(2604): at android.hardware.Camera.native_setup(Native Method)
12-21 00:04:58.120: E/AndroidRuntime(2604): at android.hardware.Camera.<init>(Camera.java:350)
12-21 00:04:58.120: E/AndroidRuntime(2604): at android.hardware.Camera.open(Camera.java:309)
12-21 00:04:58.120: E/AndroidRuntime(2604): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
12-21 00:04:58.120: E/AndroidRuntime(2604): ... 3 more
Below are the options which i get while i am trying to edit emulator.
Thanks.
I have resolved my issue by changing the emulators "Back Camera" property to Emulated as shown in screenshot.
Open Tools->Android->AVD Manager then click edit for your virtual device.Click Show Advanced Settings on your virtual device configuration window.Then camera settings field is turned on,select Emulated Front and Back.That is it.
There is no declaration about Camera in limitation of Emulator in doc.
You can Enable camera in Emulator.But emulator wont show a realtime camera regardless.
As of Android SDK version 14, the emulator supports webcams to simulate a camera:
General notes - Added webcam support to Android 4.0 or later platforms
to emulate rear-facing cameras when one webcam is present, and to
emulate both rear-facing and front-facing cameras when two webcams are
present. Webcam suport is for Windows and Linux only. Mac support will
come in a later release.
I'm using Android Studio 3.1.1 in ubuntu 16.04 and had the same issue.
So after couple of days googling, finally solved my problem by myself.
The Solution was:
Edit the AVD and set the Emulated Performance/Graphics from Automatic to Software - GLES 1.1.
Changed the SD Card size to 256 MB.
Set only one of camera (e.g. Front) to webcam0 and other one to none or emulated.
Hope this helps others with the same problem.
JUST DO THIS
use emulated in both Front and back and then chage sdcard size
From the android documentation:
Emulator Limitations
No support for camera/video capture
In other words, no, you cannot access or preview the camera in the emulator.
Related
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
I tried to integrate google play service with my unity android game. After signed in google play service, following log message appeared in DDMS and app was crashed.
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: onConnected: connected! client=1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: Connected clients updated to: 1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: connectNextClient: requested clients: 1, connected clients: 1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: Pending clients: 0
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: All clients now connected. Sign-in successful!
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: All requested clients connected. Sign-in succeeded!
02-27 13:50:00.633 13419-13419/? D/AndroidRuntime﹕ Shutting down VM
02-27 13:50:00.633 13419-13419/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415baba8)
02-27 13:50:00.633 13419-13419/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.dokinkon.projectp, PID: 13419
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.3.2f1
Device model : LGE Nexus 5
Device fingerprint: google/hammerhead/hammerhead:4.4.2/KOT49H/937116:user/release-keys
Caused by: java.lang.IllegalStateException: No AppStateClient. Did you request it at setup?
at com.google.example.games.basegameutils.GameHelper.getAppStateClient(GameHelper.java:294)
at com.android.gs.GameClientManager.onStateChange(GameClientManager.java:690)
at com.google.example.games.basegameutils.GameHelper.setState(GameHelper.java:272)
at com.google.example.games.basegameutils.GameHelper.succeedSignIn(GameHelper.java:813)
at com.google.example.games.basegameutils.GameHelper.connectNextClient(GameHelper.java:695)
at com.google.example.games.basegameutils.GameHelper.onConnected(GameHelper.java:805)
at com.google.android.gms.internal.k.y(Unknown Source)
at com.google.android.gms.internal.au.y(Unknown Source)
at com.google.android.gms.internal.k$f.a(Unknown Source)
at com.google.android.gms.internal.k$f.a(Unknown Source)
at com.google.android.gms.internal.k$b.D(Unknown Source)
at com.google.android.gms.internal.k$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I don't know what "java.lang.IllegalStateException: No AppStateClient. Did you request it at setup?" means for. Thanks.
You need to add the APPSTATE client as shown below:
//should be called on your application start
//best practice to call it only once. Any way other calls will be ignored by the plugin.
//if you want to use only Game service (Leader-boards, achievements) use GooglePlayConnection.CLIENT_GAMES
//if you want to use only Google Cloud service use GooglePlayConnection.CLIENT_APPSTATE
//if you want both: GooglePlayConnection.CLIENT_GAMES | GooglePlayConnection.CLIENT_APPSTATE
//and if you whant to get avaliable permissions for your app use: GooglePlayConnection.CLIENT_ALL
GooglePlayConnection.instance.start (GooglePlayConnection.CLIENT_GAMES | GooglePlayConnection.CLIENT_APPSTATE );
I am trying to run a simple OpenGL program in Android. I am running this in an Android 4.1 emulator. I switched on its GPU emulation and it worked fine yesterday. When I ran that today, initially it was hanging saying, OpenGL taking time to render - Wait or Close dialog box. After few runs again it was crashing saying
E/EGL_emulation(2637): Failed to establish connection with the host
followed by
11-30 11:48:10.787: E/AndroidRuntime(2637): FATAL EXCEPTION: main
11-30 11:48:10.787: E/AndroidRuntime(2637): java.lang.IllegalArgumentException: eglChooseConfig failed EGL_NOT_INITIALIZED
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.HardwareRenderer$GlRenderer.chooseEglConfig(HardwareRenderer.java:852)
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.HardwareRenderer$GlRenderer.initializeEgl(HardwareRenderer.java:804)
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:747)
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1505)
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
11-30 11:48:10.787: E/AndroidRuntime(2637): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
I guess the emulator is not able to take control of the GPU of the system, so how do I avoid this error? How do I rectify this problem?
Thanks in advance. :)
This happens to me when my computer came out standby. Restart your virtual device.
I was having the same problem in my Genymotion emulator while running a webview based application,I have restarted the emulator and it worked fine
Hi I am trying to run some sample openGl code on an emulator. I am new to Android development. It crashes on the emulator but not my device, a Samsung Galaxy Note phone N7000.
The AVD settings I tried were:
Target: Android 4.1 - API Level 16
CPU/ABI: ARM (armeabi-v7a)
SD Card: 32 MiB
Skin: Built-in : WGA800
Here are the errors on the console:
10-15 13:23:34.287: E/Trace(621): error opening trace file: No such file or directory (2)
10-15 13:23:34.848: D/libEGL(621): Emulator without GPU support detected. Fallback to software renderer.
10-15 13:23:34.878: D/libEGL(621): loaded /system/lib/egl/libGLES_android.so
10-15 13:23:34.947: D/gralloc_goldfish(621): Emulator without GPU emulation detected.
10-15 13:23:34.977: W/dalvikvm(621): threadid=11: thread exiting with uncaught exception (group=0x40a13300)
10-15 13:23:34.977: E/AndroidRuntime(621): FATAL EXCEPTION: GLThread 72
10-15 13:23:34.977: E/AndroidRuntime(621): java.lang.IllegalArgumentException: No configs match configSpec
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:863)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
10-15 13:23:35.377: I/Choreographer(621): Skipped 67 frames! The application may be doing too much work on its main thread.
10-15 13:23:36.658: I/Choreographer(621): Skipped 72 frames! The application may be doing too much work on its main thread.
Thanks
Bob
10-15 13:23:34.848: D/libEGL(621): Emulator without GPU support detected. Fallback to software renderer.
Just recreate or edit your emulator and be sure that under the hardware list you have
GPU Emulation set to Yes