나는 사진을 찍고 전달하려는 새로운 의도를 시작하는 Google 튜토리얼을 따르고 있습니다. https://developer.android.com/training/camera/photobasics . 이 예외가 발생하기 때문에 특정 지점을 지나갈 수 없습니다.Failed to find configured root that contains /storage/emulated/0/Android/data/com.example.matthew.doodlewits/files/Pictures/JPEG_20190108_220143_4398098916939163453.jpg
예외는 다음에서 발생합니다.
Uri uri = FileProvider.getUriForFile(this, "com.example.android.fileprovider", image);
아래 방법에서 :
private void takePictureSetup()
{
try
{
Intent intent = new Intent (MediaStore.ACTION_IMAGE_CAPTURE);
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timestamp + "_";
File storageDirectory = this.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(imageFileName, ".jpg", storageDirectory);
currentPathToPictureTaken = image.getAbsolutePath();
Uri uri = FileProvider.getUriForFile(this, "com.example.android.fileprovider", image);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(intent, this.RESULT_CAMERA_PHOTO);
}
catch(Exception e)
{
Log.d("**EXCEPTION**", e.getMessage());
}
}
이것은 내가 만든 XML 파일입니다.
다음은 해당 파일의 xml 레이아웃 코드입니다.
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="Android/data/com.example.package.name/files/Pictures" />
</paths>
그리고 마지막으로 내 매니페스트 파일에서 :
<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:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
문제는 공급자 경로에 있습니다.
현재 제공 업체 경로는
Android/data/com.example.package.name/...
그것은해야한다
Android/data/com.example.matthew.doodlewits/...
도움이되기를 바랍니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다