关于安卓8.0系统调用照相机白屏

我的猜想,由于8.0系统的权限申请更加的严格,也更加安全了。所以8.0系统在调用照相机的时候要在清单文件中加入以下代码,才能解决白屏不能预览的问题。

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        ......
        <provider
            android:authorities="com.bh.yy.fileprovider"
            android:name="android.support.v4.content.FileProvider"
            android:grantUriPermissions="true"
            android:exported="false">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths"/>
        </provider>
        ......
    </application>

对于 android:authorities=”com.bh.yy.fileprovider” 这一条属性,你可以改成自己的包名点fileprovider,也可以不改。都能够解决白屏不能预览的情况。

如果有什么扩展的需求或者我有什么遗失和错误欢迎评论,我会第一时间回复和更新。

猜你喜欢

转载自blog.csdn.net/qq_38001118/article/details/80026541