I have included a gif image in react native project and its working perfectly in IOS without any issues.
my Js file
<Image
source={require("../resources/toolbar/transaction_success.gif")}
style={styles.logo}
/>
For android, I came across a library(FRESCO) which supports gif in android.
compile 'com.facebook.fresco:animated-gif:1.8.1'
Android build.gradle
dependencies {
compile project(':react-native-sensitive-info')
compile project(':react-native-i18n')
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
compile 'com.facebook.fresco:animated-gif:1.8.1'
}
Its not displaying gif after including this library.
I have tried some other versions of same library but its not working.
compile 'com.facebook.fresco:fresco:1.5.0'
compile 'com.facebook.fresco:animated-gif:1.5.0'
compile 'com.facebook.fresco:animated-gif:0.+'
compile 'com.facebook.fresco:animated-gif:0.12.0'
compile 'com.facebook.fresco:animated-base-support:0.14.1'
compile 'com.facebook.fresco:animated-gif:0.14.1'
If I use these below two lines application closes without any error.
compile 'com.facebook.fresco:fresco:1.8.1'
compile 'com.facebook.fresco:animated-gif:1.8.1'
Please help me how to resolve this.
Here in this way I resolved this.
1) Removed all existing Fresco dependencies like fresco.fresco , animated.gif etc..
2). Tried React-native-fast image based on community suggestions.Linked to both ios and android platforms. Getting error --Native component for fast image view does not exist. Dropped plan of using this npm library.
3) Added only below line to android/build-gradle .
compile 'com.facebook.fresco:animated-gif:1.3.0'
4)Tap Sync Now option in android studio so that it will reflect grade changes.
5) Clean Project.
6) Rebuild Project.
you can take both debug and release builds.
It works fine.