Source code does not match the bytecode

博客提到当源代码与字节码不匹配时,可通过Build菜单下的Rebuild Project操作来解决问题,这是一种常见的代码构建处理方式。

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

Build==》Rebuild Project 

deviceListLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), result -> { if (result.getResultCode() == RESULT_OK && !isFinishing()) { // 增加生命周期校验 Intent data = result.getData(); // 处理设备列表返回的数据 if (data != null) { String deviceAddress = data.getStringExtra("device_address"); // 严格校验设备地址 if (deviceAddress == null || deviceAddress.isEmpty()) { Log.e(TAG, "设备地址为空"); return; } // 确保UI操作在主线程 runOnUiThread(() -> { if (tv_blueTooth != null) { tv_blueTooth.setText(deviceAddress); } }); // 耗时操作异步处理 new Thread(() -> { try { //initOPSClient(deviceAddress); cardConnSta = true; Log.d(TAG, "设备连接成功: " + deviceAddress); } catch (Exception e) { Log.e(TAG, "初始化失败", e); } }).start(); } } }); private void openBlueTh() { Log.d(TAG, "初始化蓝牙!"); if (!mBluetoothAdapter.isEnabled()) { Intent enableIntent = new Intent( BluetoothAdapter.ACTION_REQUEST_ENABLE); //startActivityForResult(enableIntent, REQUEST_ENABLE_BT); bluetoothEnableLauncher.launch(enableIntent); // 使用新API Log.d("OPS:openBlueTh","发送启用蓝牙的 Intent"); } Intent serverIntent2 = new Intent(this, DeviceListActivity.class); deviceListLauncher.launch(serverIntent2); // 使用新API Log.d("OPS:openBlueTh","选择设备成功 Intent"); } 回调函数执行后闪退,debug时回调函数执行到最后一步,IDE提示:Source code does not match the bytecode
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值