build.gradle:
dependencies{
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.facebook.fresco:fresco:1.0.1'
compile 'com.facebook.fresco:imagepipeline-okhttp3:+'
compile 'com.facebook.fresco:animated-gif:1.3.0'
}
error:
Caused by: java.lang.NoClassDefFoundError: com.facebook.drawee.view.DraweeHolder
at com.facebook.drawee.view.DraweeView.init(DraweeView.java:78)
at com.facebook.drawee.view.DraweeView.<init>(DraweeView.java:58)
at com.facebook.drawee.view.GenericDraweeView.<init>(GenericDraweeView.java:42)
at com.facebook.drawee.view.SimpleDraweeView.<init>(SimpleDraweeView.java:62)
react-native(0.43.3) integration is the 1.0.1 version, so when the original use of the GIF model may have this problem
Hi @coutliuxing !
Please make sure that you are using the same version for all the Fresco imports, also use explicit versions (1.3.0 instead of + or 1+). In your case you got Fresco 1.0.1 but Fresco animated GIF 1.3.0.
@erikandre As you say, but it's the same problem. Is there anything else to change?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.facebook.fresco:fresco:1.0.1'
compile 'com.facebook.fresco:imagepipeline-okhttp3:+'
compile 'com.facebook.fresco:animated-gif:1.0.1'
}
Ok, there are two things you might want to check
Btw. Is this an app that is big enough that is is using multidex?
@erikandre i did not use proguard or dexguard,and the logcat no show any error on installing.This example can reproduce the problem, trouble to help look at, thank you!
fresco.zip
Only set up so that it can be used normally:
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.facebook.fresco:animated-gif:1.3.0'
@coutliuxing, I just tried out your project and I got it to run and play the GIF animation.
I did have to change build.gradle though as the project did not build otherwise. It looks like maybe some files were missing in the zip file you attached?
Anyways, here is the gradle file after my changes (which should not be related to the error you are seeing).
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "inavr.fresco"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// exclude group: 'com.google.code.findbugs', module: 'jsr305'
// })
compile 'com.android.support:appcompat-v7:25.3.1'
// compile 'com.android.support.constraint:constraint-layout:1.0.2'
// testCompile 'junit:junit:4.12'
// compile 'com.facebook.fresco:imagepipeline-okhttp3:+'
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.facebook.fresco:animated-gif:1.3.0'
// compile 'com.facebook.fresco:fresco:1.0.1'
// compile 'com.facebook.fresco:animated-gif:1.0.1'
}
i know it could be worked in the laster version,but it could not be work in the 1.0.1 version.
So Could you provide the code that worked in the 1.0.1 version? Because react native integrates this version
I have the same problem upgrading to react-native 0.43.3. If change my _app/build.gradle_ from:
compile 'com.facebook.fresco:animated-gif:1.1.0'
to:
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.facebook.fresco:animated-gif:1.3.0'
Then I get:
java.lang.AbstractMethodError: abstract method "void com.facebook.imagepipeline.producers.ProducerListener.onUltimateProducerReached(java.lang.String, java.lang.String, boolean)"
at com.facebook.imagepipeline.listener.ForwardingRequestListener.onUltimateProducerReached(ForwardingRequestListener.java:144)
...adding compile 'com.facebook.fresco:imagepipeline-okhttp3:1.3.0' doesn't help.
I think the later problem is an incompatibility between the current version of Fresco and that used by React Native, which is still 1.0.1.
Fresco 1.3 introduced a breaking change to the ProducerListener listener and the necessary change to the SystraceRequestListener class was included in React Native 0.44.0 but earlier versions would be incompatible with Fresco 1.3.
If you need React Native to be upgraded to the latest version of Fresco you could raise an issue or PR on that project.
We seemed to have the same bug and reverting to 1.0.1 fixed it. We are on react-native 0.44.0.
Yeah, please make sure that React Native and Fresco have the same version to keep everything in sync.
Most helpful comment
Only set up so that it can be used normally:
compile 'com.facebook.fresco:fresco:1.3.0' compile 'com.facebook.fresco:animated-gif:1.3.0'