Tag Archives: Android 7.0 Photo Error

Android 7.0 Photo Problem: file:///storage/emulated/0/photo.jpeg exposed beyond app through ClipData.Item.getUri

a new error occurred when Android 7.0 called the camera:

android.os.FileUriExposedException: file:///storage/emulated/0/photo.jpeg exposed beyond app through ClipData.Item.getUri()

solutions:

add the following code to the oncreat() method of application:

        // android 7.0 The system solves the problem of taking pictures
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        builder.detectFileUriExposure();