vault-development / react-native-svg-uri

Render SVG images in React Native from an URL or static file
849 stars 335 forks source link

The file name must end with .xml or .png #164

Open berpcor opened 5 years ago

berpcor commented 5 years ago

My problem is: I generate apk in Android studio and get error "The file name must end with .xml or .png". The problem connected to files I add to the page using (import SvgUri from 'react-native-svg-uri';) tag. Those are the only files that has extension of svg in drawable-mdpi folder. What to do? Is this problem connected to your library or not?

tmxiong commented 5 years ago

add this code android.disableResourceValidation=true in android/gradle.properties

manoj2166 commented 5 years ago

I have same issue

silasvasconcelos commented 5 years ago

It worked for me, thanks

Update: didn't work, the android doesn't load the SVG files!

syedtehrimabbas commented 5 years ago

Error Android: Using SVG in res leads to an error: “The file name must end with .xml or .png”

use this chunk of code in gradle.properties as well as in build.gradle project level

defaultConfig { versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true }

android.disableResourceValidation=true

lyseiha commented 5 years ago

the error still existed.

msqar commented 5 years ago

Some people say we have to use react-native-svg for Android, damn. Would be nice to have a fix for this.

rashidul-hasan commented 5 years ago

Any fix for this issue yet?

pragyanshukukreti commented 5 years ago

God i am searching for this issue and seeing threads which are older then my late grandfather. Still unresolved. I have used ImageView and this error is popping up for an image I am using.

msqar commented 5 years ago

I ended up using react-native-svg-uri-reborn. Had to make some modifications to it because it was adding a black background fill by default, the owner calls it "reborn", promises more support than this github, and disappears for months without even replying. For Android what i did was using svgXmlData={svgString}. It lets you add a direct SVG string. So Android won't bother again.

if 'android' === Platform.OS ? i use svgXmlData={svgString}, otherwise i use normal source={path}

zjz1993 commented 4 years ago

add android.disableResourceValidation=true in android/gradle.properties is work for me.

hakimhassan97 commented 4 years ago

'inlining' the svg works for me, using react-native-svg image