Android App&x27;s函数在模拟器上运行,但不在实际设备上运行

Android App&x27;s函数在模拟器上运行,但不在实际设备上运行,android,android-studio,android-emulator,Android,Android Studio,Android Emulator,我正在安装摄像头应用程序。有诸如“捕获”、“旋转相机”、“画廊”、“返回”等功能。应用程序在emulator上运行,包括所有功能,但在真实设备上,“捕获”和“旋转相机”不起作用 我已经尝试过即时运行-清理和重建应用程序 主要活动 camera.captureImage { camera, capturedImage -> val savedPhoto = File(Environment.getExternalStorageDirectory(), "photo.j

我正在安装摄像头应用程序。有诸如“捕获”、“旋转相机”、“画廊”、“返回”等功能。应用程序在emulator上运行,包括所有功能,但在真实设备上,“捕获”和“旋转相机”不起作用

我已经尝试过即时运行-清理和重建应用程序

主要活动

camera.captureImage { camera, capturedImage ->
            val savedPhoto = File(Environment.getExternalStorageDirectory(), "photo.jpg")
            try {
                val outputStream = FileOutputStream(savedPhoto.path)
                outputStream.write(capturedImage)
                outputStream.close()
            } catch (e: java.io.IOException) {
                e.printStackTrace()
            }
            //capturedImage converted to bitmap
            var bitmap: Bitmap = BitmapFactory.decodeByteArray(capturedImage, 0, capturedImage.size)
            capturedImageView.setImageBitmap(bitmap)
            capturedImageView.visibility=View.VISIBLE

我希望应用程序的所有功能都在emulator和real device(通用移动5 Plus)中运行,希望您使用的是Camera2,而不仅仅是Camera。并在使用Camera2时提供以下权限

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2.full" />
<uses-feature android:name="android.hardware.camera2.autofocus" />


您是否收到任何错误、崩溃、日志消息?仅此:拒绝访问查找属性“persist.camera.cfa.packagelist”是某台设备不工作,还是其他设备很少工作?开始时,它在我的真实设备上工作,但重新启动Android Studio后,不再工作。这可能是什么原因造成的?因为xml、manifest或.gradle?我已经搜索了将近3个小时-卸载应用程序并重新安装(尝试重新启动设备)-从链接下载该项目,如果它有效,请让我进一步了解()我已经用另一台真实设备(三星a7)进行了测试并工作了fineSee,这就是我告诉你的,可能就是这个问题,祝贺你。