Caused by: java.lang.RuntimeException: setParameters failed 解决方法

本文详细解析了在使用设备摄像头时遇到的setParameters failed错误,原因在于设置的分辨率与设备支持的分辨率不符。通过调整参数至设备支持的分辨率,成功解决了这一问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

代码如下:

if (mCamera == null) {
    mCameraId = findFrontFacingCamera();
    mCamera = Camera.open(mCameraId);

    Camera.Parameters parameters = mCamera.getParameters();
    parameters.setPictureSize(CAMERA_PREVIEW_WIDTH_ORI, CAMERA_PREVIEW_HEIGHT_ORI);
    parameters.setPreviewSize(CAMERA_PREVIEW_WIDTH_ORI, CAMERA_PREVIEW_HEIGHT_ORI);
    parameters.setRotation(90);
    mCamera.setParameters(parameters);
    mPreview.refreshCamera(mCamera);
}

使用设备摄像头时,报错:Caused by: java.lang.RuntimeException: setParameters failed

原因是,设置的摄像头分辨率与设备实际支持的分辨率不相匹配

解决方法:此处代码设置为摄像头支持的分辨率 

parameters.setPictureSize(CAMERA_PREVIEW_WIDTH_ORI, CAMERA_PREVIEW_HEIGHT_ORI); parameters.setPreviewSize(CAMERA_PREVIEW_WIDTH_ORI, CAMERA_PREVIEW_HEIGHT_ORI);

 

 

 

 

参考:https://www.cnblogs.com/vampirejt/p/3832878.html

Creating a new SqlSession Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4627acfe] JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@6e82008b] will be managed by Spring ==> Preparing: SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.web_gen_path, t.incorporated_entity, t.page_url, t.del_url, t.au_url, t.wy_url, t.cl_type, t.is_cache, t.is_cache_time, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort, c.grid_id_title, c.grid_select, c.grid_table_rows, c.grid_list_url, c.grid_wy_url, c.open_filed, c.max_length, c.regulars FROM gen_table t LEFT JOIN gen_table_column c ON t.table_id = c.table_id where t.table_name = ? order by c.sort ==> Parameters: asset_check_task_item(String) <== Total: 0 Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4627acfe] Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4627acfe] Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4627acfe] 15:45:51.488 [restartedMain] ERROR o.s.b.SpringApplication - [reportFailure,870] - Application run failed java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:820) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:801) at org.springframework.boot.SpringApplication.run(SpringApplication.java:350) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1359) at com.feosd.FeosdApplication.main(FeosdApplication.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.NullPointerException: null at com.feosd.generator.service.GenTableServiceImpl.synchDb(GenTableServiceImpl.java:374)
03-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值