简体   繁体   English

Android Studio中的NoClassDefFoundError

[英]NoClassDefFoundError in Android Studio

I'm working with camera2 in Android Studio and when testing it I get a NoClassDefFoundError (runtime exception) on this line: 我正在Android Studio中使用camera2,并且在对其进行测试时,在此行上收到NoClassDefFoundError(运行时异常):
mCameraManager.openCamera("0", new CameraDevice.StateCallback() {
I'm not sure what's causing this, but looking around at NoClassDefFoundError in general leads me to believe that it's caused when the static initialization code for a class (here, presumably CameraDevice.StateCallBack?) throws an exception. 我不确定是什么原因造成的,但是通常环顾NoClassDefFoundError会让我相信这是由于类的静态初始化代码(这里大概是CameraDevice.StateCallBack?)引发异常而引起的。 I'm wondering how I can fix this error. 我想知道如何解决此错误。 Do I need to initialize the CameraDevice.StateCallback in some other way? 我是否需要以其他方式初始化CameraDevice.StateCallback?

This is method got added in API level 21 (Lollipop). 此方法已添加到API级别21(Lollipop)中。 This means you are testing on a device that has an API lower than 21. 这意味着您正在API低于21的设备上进行测试。

You can always check th documentation . 您可以随时检查文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM