[개발] flutter - android 파일 첨부 처리

in #flutter5 years ago

개요

스팀잇 사이트에서 파일을 첨부하기 위해 필요한 준비사항을 기술

오류

Couldn't find meta-data for provider with authority

flutter webview 에서 사진 첨부시 오류 해결

W/System.err(29993): java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com

해결

1. 파일수정

: android/app/src/main/AndroidManifest.xml

아래와 같이 추가


...xml
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="me.albie.share"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
...
    </application>
</manifest>

2. 폴더생성

: android/app/src/main/res/xml

3. 파일생성

: android/app/src/main/res/xml/file_paths.xml

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

결과물

모바일 키체인을 구현하여 파일을 업로드 할 수 있다. 물론 카메라로 바로 사진을 찍어 업로드 할 수도 있음.

ezgif-6-e931fa5626dd.gif

참조링크

Coin Marketplace

STEEM 0.05
TRX 0.33
JST 0.082
BTC 62530.03
ETH 1633.28
USDT 1.00
SBD 0.44