saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.99k stars 1.2k forks source link

could not open camera:err=-1 #275

Open coffeeplanter opened 6 years ago

coffeeplanter commented 6 years ago

Hi, guys!

While launching the test apps I'm getting error: E/UVCCamera: [11204*UVCCamera.cpp:172:connect]:could not open camera:err=-1

usbcameratest, usbcameratest0, usbcameratest2 are also crashing with the following message:

E/UVCCamera: [7771*UVCCamera.cpp:172:connect]:could not open camera:err=-1
E/AndroidRuntime: FATAL EXCEPTION: BaseActivity
Process: com.serenegiant.usbcameratest0, PID: 7753
java.lang.UnsupportedOperationException: open failed:result=-1
at com.serenegiant.usb.UVCCamera.open(UVCCamera.java:204)
at com.serenegiant.usbcameratest0.MainActivity$2$1.run(MainActivity.java:149)
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)

Using the latest sdk 27 and ndk 16, Logitech cam, and Samsung SM-A710F device.

Help me please to find the reason of the error and fix it.

grliao commented 6 years ago

may be this can help you. https://github.com/saki4510t/UVCCamera/issues/181

MichaelLeeJones commented 6 years ago

You can try switching the NDK version to 12

dmitrykb commented 6 years ago

I'm having the same issue with Inogeni and Pixel on 8.0. Switching to NDK 14b didn't help.

zangpuu commented 6 years ago

I also had same problems with NDK15 and eventually found that clang was the reason. Then I change the compiler to gcc by uncomment "NDK_TOOLCHAIN_VERSION := 4.9" from "libuvccamera/src/main/jni/Application.mk". And it works now.

shibbs commented 6 years ago

this solved the issue for me, thank you @zangpuu

shibbs commented 6 years ago

@dmitrykcom This fixed it for me on a different phone/camera setup but I'm now also having issues with the inogeni and a pixel 2. Did you have any success?

HuitMahoon commented 5 years ago

I also had same problems with NDK15 and eventually found that clang was the reason. Then I change the compiler to gcc by uncomment "NDK_TOOLCHAIN_VERSION := 4.9" from "libuvccamera/src/main/jni/Application.mk". And it works now.

this works for me , thanks

zipswich commented 3 months ago

After a series of recent Android SDK package updates, this error started to happen. I confirmed this by making sure the code is exactly the same as it was a few weeks ago when it was working. There were so many updates that it is impossible to pinpoint the culprit update.