• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    해결됨

해결안되는 에러.. Failed to find configured root that contains /null/

20.01.20 19:58 작성 조회수 2.19k

0

로그 에러 메세지

----------------------------------------------------

Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /null/불량1579517621338.jpg  <--(파일이름)

----------------------------------------------------

xml 파일

---------------------------------------------------

<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="storage/emulated/0"
path="."/>
</paths>
--------------------------------------------------------


메인 엑티비티 문제가 되는 매서드
--------------------------------------------------------
public void button(View v) {
Intent intent = new Intent((MediaStore.ACTION_IMAGE_CAPTURE));

String name = "/불량" + System.currentTimeMillis() + ".jpg";
String pic_path = path + name;

File file = new File(pic_path);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
contenturi = FileProvider.getUriForFile(this, "co.co", file);
} else {
contenturi = contenturi.fromFile(file);
}

intent.putExtra(MediaStore.EXTRA_OUTPUT, contenturi);
startActivityForResult(intent, 0);

}

------------------------------------------------------

manifest provider 부분

-----------------------------------------------------

<provider
android:authorities="co.co"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">

<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/xml"/>


</provider>
-------------------------------------------------------

구글링 해보니까 

xml 파일에 이상이 있다는것 같은데요.

정상 작동하는 앱의 코드를 전부 복사 붙여넣기 해도 저 에러가 뜹니다.  

저 에러는 어떤 경우에 발생하는 건가요?

답변 2

·

답변을 작성해보세요.

1

nury님의 프로필

nury

지식공유자

2020.01.21

안드로이드 10때 바뀐 부분때문에 그런것 같습니다. build.gradle 파일을 열어 targetSdkVersion과 compileSdkVersion을 28로 설정하고 테스트 해보시기 바랍니다.

0

박정훈님의 프로필

박정훈

질문자

2020.01.23

감사합니다.

경로를 바꿔가면서 해결했습니다. 뭐때문인지는 모르겠지만 경로 를 못찾을경우에는 그냥 경로를 바꿔 버리니까 해결이 되긴하네요..