Android GIF 支持 -- React Native 0.50
Android GIF Support -- React Native 0.50
我在 React Native 项目中包含了一个 gif 图片,它在 IOS 中完美运行,没有任何问题。
我的Js文件
<Image
source={require("../resources/toolbar/transaction_success.gif")}
style={styles.logo}
/>
对于 android,我在 android 中遇到了一个支持 gif 的库 (FRESCO)。
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'
}
包含此库后不显示 gif。
我已经尝试了同一个库的一些其他版本,但它不起作用。
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'
如果我使用以下两行,应用程序将无任何错误地关闭。
compile 'com.facebook.fresco:fresco:1.8.1'
compile 'com.facebook.fresco:animated-gif:1.8.1'
请帮我解决这个问题。
这里我就是这样解决的。
1) 删除了所有现有的 Fresco 依赖项,例如 fresco.fresco、animated.gif 等。
2).已尝试 React-native-fast 基于社区 suggestions.Linked 的图像到 ios 和 android 平台。出现错误——用于快速查看图像的本机组件不存在。放弃使用此 npm 库的计划。
3) 仅在 android/build-gradle 的下一行添加。
compile 'com.facebook.fresco:animated-gif:1.3.0'
4) 在 android 工作室中点击“立即同步”选项,以便反映成绩变化。
5) 清理项目。
6) 重建项目。
您可以同时使用调试版本和发布版本。
它工作正常。
加入你的build.gradle
:
compile 'com.facebook.fresco:fresco:1.9.0'
compile 'com.facebook.fresco:animated-gif:1.9.0'
我在 React Native 项目中包含了一个 gif 图片,它在 IOS 中完美运行,没有任何问题。
我的Js文件
<Image
source={require("../resources/toolbar/transaction_success.gif")}
style={styles.logo}
/>
对于 android,我在 android 中遇到了一个支持 gif 的库 (FRESCO)。
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'
}
包含此库后不显示 gif。
我已经尝试了同一个库的一些其他版本,但它不起作用。
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'
如果我使用以下两行,应用程序将无任何错误地关闭。
compile 'com.facebook.fresco:fresco:1.8.1'
compile 'com.facebook.fresco:animated-gif:1.8.1'
请帮我解决这个问题。
这里我就是这样解决的。
1) 删除了所有现有的 Fresco 依赖项,例如 fresco.fresco、animated.gif 等。
2).已尝试 React-native-fast 基于社区 suggestions.Linked 的图像到 ios 和 android 平台。出现错误——用于快速查看图像的本机组件不存在。放弃使用此 npm 库的计划。
3) 仅在 android/build-gradle 的下一行添加。
compile 'com.facebook.fresco:animated-gif:1.3.0'
4) 在 android 工作室中点击“立即同步”选项,以便反映成绩变化。
5) 清理项目。
6) 重建项目。
您可以同时使用调试版本和发布版本。
它工作正常。
加入你的build.gradle
:
compile 'com.facebook.fresco:fresco:1.9.0'
compile 'com.facebook.fresco:animated-gif:1.9.0'