Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Regression with animated gifs in react native 0.43 - hard crash #13345

Closed
forki opened this issue Apr 6, 2017 · 14 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@forki
Copy link
Contributor

forki commented Apr 6, 2017

Description

After the upgrade to react native 0.43 from 0.42 our app crashes hard on the display of animated gifs.

Reproduction Steps and Sample Code

In http://facebook.github.io/react-native/releases/0.43/docs/image.html#gif-and-webp-support-on-android you describe how to use animated gifs with react native. Basically it's adding one line to android/app/build.gradle:

compile 'com.facebook.fresco:animated-gif:0.11.0'

and then just using the Image tag.

As a repro we did that on top of hello world sample:

For repro:

  1. Clone the project
  2. Check out a branch
  3. run npm install
  4. open android emulator
  5. run react-native run-android

Additional Information

  • React Native version: 0.43.1 and 0.43
  • Platform: Android
  • Development Operating System: Windows 10
  • Dev tools: Command line
@forki forki changed the title Regression with animated gifs in react native 0.43 on Android [Android] Regression with animated gifs in react native 0.43 Apr 6, 2017
@forki forki changed the title [Android] Regression with animated gifs in react native 0.43 [Android] Regression with animated gifs in react native 0.43 - hard crash Apr 6, 2017
@Thomas101
Copy link
Contributor

We're seeing this as well. I've attached the stack trace below. I tried blindly updating fresco to 1.2.0 on the off chance that might fix it, but no beans

04-07 09:36:57.413 12727 12887 E AndroidRuntime: java.lang.NoSuchFieldError: No field forceOldAnimationCode of type Z in class Lcom/facebook/imagepipeline/common/ImageDecodeOptions; or its superclasses (declaration of 'com.facebook.imagepipeline.common.ImageDecodeOptions' appears in /data/app/com.loclydiscover-1/base.apk)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.animated.factory.AnimatedImageFactoryImpl.decodeGif(AnimatedImageFactoryImpl.java:84)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeGif(DefaultImageDecoder.java:142)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:65)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:123)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:239)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:111)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:144)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
04-07 09:36:57.413 12727 12887 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:761)
04-07 09:36:57.427   919 15381 W ActivityManager:   Force finishing activity com.loclydiscover/.MainActivity

@forki
Copy link
Contributor Author

forki commented Apr 7, 2017

just to make this clear: the app crashes completely. It's really serious.

@foggy1
Copy link

foggy1 commented Apr 9, 2017

Thirded. Hard crash on 0.43.

@cbjs
Copy link

cbjs commented Apr 9, 2017

fixed by updating dependencies from 0.11.0 to 0.14.1

compile 'com.facebook.fresco:animated-base-support:0.14.1'
compile 'com.facebook.fresco:animated-gif:0.14.1'

maybe the doc is outdated.

@forki
Copy link
Contributor Author

forki commented Apr 10, 2017

I can confirm that fresco 0.14.1 works indeed. Weird thing is that v 1.2 doesn't.

PR for docs: #13419

forki added a commit to forki/react-native that referenced this issue Apr 10, 2017
@forki
Copy link
Contributor Author

forki commented Apr 10, 2017

@AndrewJack proposed to use 1.0.1 - which seems to work as well.

@HidemanX
Copy link

build.gradle => android => buildToolsVersion "25.0.0" can fix it.

@Thomas101
Copy link
Contributor

Upgrading to fresco 1.0.1 fixed for us. Thanks everyone!

Maxwell2022 pushed a commit to Maxwell2022/react-native that referenced this issue Apr 19, 2017
…13345

Summary:
Thanks for submitting a PR! Please read these instructions carefully:

React Native crashes hard on fresco 0.11.0 - see facebook#13345

Repro case in facebook#13345
Closes facebook#13419

Differential Revision: D4913258

Pulled By: javache

fbshipit-source-id: 8beb55102e0f2d362c77698a35ea7d57fdcba48d
thotegowda pushed a commit to thotegowda/react-native that referenced this issue May 7, 2017
…13345

Summary:
Thanks for submitting a PR! Please read these instructions carefully:

React Native crashes hard on fresco 0.11.0 - see facebook#13345

Repro case in facebook#13345
Closes facebook#13419

Differential Revision: D4913258

Pulled By: javache

fbshipit-source-id: 8beb55102e0f2d362c77698a35ea7d57fdcba48d
shirbr510 added a commit to GLLU/mobile that referenced this issue May 12, 2017
shirbr510 added a commit to GLLU/mobile that referenced this issue May 14, 2017
* upgraded to RN 0.43.4 and most other dependencies

* Fixed style issues caused by native-base in some components 

* deleted ‘home’ page (was not used anywhere)

* Made BadNavigationScreen into a Functional Component

* Replaced all the native-base view and text with react-native view and text

* Removed duplicate permissions from AndroidManifest

* fixed ‘next’ button style in uploadLookScreen

* Added missing binding in addItemScreen constructor

* fixed clear button

* Fixed gif issue (facebook/react-native#13345)

* Aligned Gllu.Button text

* aligned report and back button in profile screen

* fixed LikeView alignment

* Fixed incorrect styling of LikeView

* fix look screen keys bug

* Removed weird gap in bottom of comments view

* ios changes for rn0.40

* fixed empty view style issues in Notifications/Followers & Following screens

* App loads react modules correctly. (Still have to deal with Flurry bug)

* Fixed iOS flurry bug (resolved react-native-config version straight form sources instead of fork)

* fixed missing config files in build.gradle
shirbr510 added a commit to GLLU/mobile that referenced this issue May 14, 2017
* upgraded to RN 0.43.4 with broken dependencies

* Fixed style issues cause by native-base in some components (will be fully fixed in future commit)

* deleted ‘home’ page (was not used anywhere)

* Removed some native-base redundant form components

* handled some parts of sign-in and splash screen to be “native-base less”

* Made BadNavigationScreen into a Functional Component

* Fixed native-base issues in activation page

* fixed native-base issues in signup page

* Replaced all the native-base view and text with react-native view and text

* Animations look AWESOME

* Refactored most of the flow of uploadLook

* tiny refactor for brands autocomplete

* Fixed native-base style issues in uploadLook (all stages)

* fixed native-base issues with profilescreen & settings screen

* Fixed broken react-native-video

* fixed disappearing list views

* Updated package son for RN0.43

* Removed duplicate permissions from AndroidManifest

* fixed ‘next’ button style in uploadLookScreen

* Added missing binding in addItemScreen constructor

* fixed clear button

* Fixed gif issue (facebook/react-native#13345)

* Aligned Gllu.Button text

* aligned report and back button in profile screen

* fixed LikeView alignment

* Fixed incorrect styling of LikeView

* fix look screen keys bug

* Removed weird gap in bottom of comments view

* ios changes for rn0.40

* fixed empty view style issues in Notifications/Followers & Following screens

* App loads react modules correctly. (Still have to deal with Flurry bug)

* Fixed iOS flurry bug (resolved react-native-config version straight form sources instead of fork)

* fixed missing config files in build.gradle

* Feature/native android camera component (#208)

* - Integrate camera native component

*  -Change default record circle button.
- Force default front camera.
- Crop image after stillshot.
- Set crop aspect ratio to 9:16

* - Change cropper action bar background.
- Remove unnecessary buttons.
- Add flip horizontal button.
- Remove image preview screen.
- Fix taking photos on some devices.

* - Fix video stretching.
- Video preview now showed full screen

* Remove from gitignore

* - Remove rotate button.
- Fix landscape camera crash (disable landscape)

* - Add trimer library

* Trim Video settings

* Integrate video trimming in entire flow
@Sir-hennihau
Copy link

Tried to use the recommended (02.09.2017) compile 'com.facebook.fresco:animated-base-support:1.3.0' with RN 0.45 and it crashed, but tested it succesfully with the newer release RN 0.48. Downgraded my app in RN to fresco 1.0.1 as mentioned above and gif works in RN 0.45 .

Maybe this could be mentioned somewhere in a more official place?

@AleCaste
Copy link

I am using RN 0.50.3
I have tried com.facebook.fresco:animated-gif v0.12.0, v0.14.1, v1.0.1, v1.3.0 ... but the app always hard-crashes on me as soon as a GIF is to be displayed.
Even tried changing buildToolsVersion 23.0.1 to 25.0.0 as someone else suggested, but no luck either.
I have no idea what to do!!!
My Android version is 5.1.1

@AleCaste
Copy link

The crash log I am getting is:

E/AndroidRuntime(28788): FATAL EXCEPTION: Thread-6976
E/AndroidRuntime(28788): Process: com.rn_test, PID: 28788
E/AndroidRuntime(28788): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/imagepipeline/memory/PooledByteBuffer;
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.animated.factory.AnimatedImageFactoryImpl.decodeGif(AnimatedImageFactoryImpl.java:84)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeGif(DefaultImageDecoder.java:145)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:65)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:126)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:240)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:112)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:145)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
E/AndroidRuntime(28788):        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(28788):        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(28788):        at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
E/AndroidRuntime(28788):        at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime(28788): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.imagepipeline.memory.PooledByteBuffer" on path: DexPathList[[zip file "/data/app/com.rn_test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.rn_test-1/lib/arm, /vendor/lib, /system/lib]]
E/AndroidRuntime(28788):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(28788):        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(28788):        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime(28788):        ... 14 more
E/AndroidRuntime(28788):        Suppressed: java.lang.ClassNotFoundException: com.facebook.imagepipeline.memory.PooledByteBuffer
E/AndroidRuntime(28788):                at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(28788):                at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime(28788):                at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime(28788):                at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime(28788):                ... 15 more
E/AndroidRuntime(28788):        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

@AleCaste
Copy link

UPDATE: If I add:

compile 'com.facebook.fresco:imagepipeline-okhttp3:1.3.0'

... to the dependencies block of android/app/build.gradle, then animated GIFs work fine and I do not get the crash.
But the documentation on https://facebook.github.io/react-native/docs/image.html does not say that we must explicitly add this dependency. In my case I have to since otherwise my app crashes.
Is this normal?

@Annihil
Copy link

Annihil commented Feb 21, 2018

I tried every combination, the following setup is the only working one:
react-native: 0.53.0
buildToolsVersion "27.0.2"
classpath 'com.android.tools.build:gradle:3.0.1'

compile 'com.facebook.fresco:animated-base-support:1.3.0'
compile 'com.facebook.fresco:animated-gif:1.3.0'

@star-heng
Copy link

this way:
react-native: 0.53.3
buildToolsVersion "25.0.2"
targetSdkVersion 25
classpath 'com.android.tools.build:gradle:2.3.2'

compile 'com.facebook.fresco:animated-gif:1.3.0'

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants