我在react本机项目中包含了一个gif图像,它在IOS中完美地工作,没有任何问题。
我的Js档案
<Image
source={require("../resources/toolbar/transaction_success.gif")}
style={styles.logo}
/>对于android,我偶然发现了一个库(壁画),它支持android中的gif。
编译‘com.facebook.Fresco:动画-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'请帮我解决这个问题。
发布于 2018-03-19 08:38:52
我用这种方式解决了这个问题。
1)删除了现有的弗雷斯科依赖项,如fresco.fresco、animated.gif等。
2)。尝试了基于社区suggestions.Linked的本地快速图像对ios和安卓平台的反应。获取错误--不存在用于快速图像视图的本机组件。放弃使用这个npm库的计划。
3)只在android/中添加以下内容。
编译‘com.facebook.Fresco:动画-gif:1.3.0’
4)点击同步选项,在android演播室,以便它将反映年级的变化。
5)清洁工程。
( 6)重建工程。
您可以同时进行调试和发布版本。
效果很好。
发布于 2018-07-14 17:23:01
加入你的build.gradle
compile 'com.facebook.fresco:fresco:1.9.0'
compile 'com.facebook.fresco:animated-gif:1.9.0'https://stackoverflow.com/questions/49356379
复制相似问题