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

Unable to compile: Duplicate interface definition for class 'FLAnimatedImageView' #46

Closed
DerJacques opened this issue Aug 18, 2017 · 46 comments

Comments

@DerJacques
Copy link

Hi there!

I'm having problems compiling my app after adding react-native-fast-image.

After running react-native link react-native-fast-image, I receive a bunch of duplicate interface definition for class 'FLAnimatedImageView' and property has a previous declaration errors.

Here's a subset of the errors I receive:

In file included from /Users/manuelthomsen/Coding/experiments/expo/woodn/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m:16:
In file included from /Users/manuelthomsen/Coding/experiments/expo/woodn/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h:13:
/Users/manuelthomsen/Coding/experiments/expo/woodn/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.h:22:1: error: duplicate interface definition for class 'FLAnimatedImageView'
@interface FLAnimatedImageView : UIImageView
^
In module 'FLAnimatedImage' imported from /Users/manuelthomsen/Coding/experiments/expo/test/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.h:14:
/Users/manuelthomsen/Library/Developer/Xcode/DerivedData/test-ftzdxdyafvkexabeahltbammdnfq/Build/Products/Debug-iphonesimulator/FLAnimatedImage.framework/Headers/FLAnimatedImageView.h:22:12: note: previous definition is here
@interface FLAnimatedImageView : UIImageView
           ^
In file included from /Users/manuelthomsen/Coding/experiments/expo/test/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m:16:
In file included from /Users/manuelthomsen/Coding/experiments/expo/test/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h:13:
/Users/manuelthomsen/Coding/experiments/expo/test/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.h:26:48: error: property has a previous declaration
@property (nonatomic, strong) FLAnimatedImage *animatedImage;

Any ideas on how to solve this?
This is a basic expo app that has just been detached.

Tested on RN v. 46 and 47.

Thank you!

@fredzhang
Copy link

same problem here. please help

@mortezaalizadeh
Copy link

Same problem here :)

@denny64
Copy link

denny64 commented Aug 28, 2017

+1

@jacksontbryan
Copy link

Blowing away the contents of my ios/build folder cleared this for me. The error only happened from react-native run-ios and wasn't reproducible from xcode directly.

@srameshr
Copy link

@jacksontbryan Did that. It did not solve the problem for me. It occurs when building for iPhone 5s and iOS version 9.0

@MrLoh
Copy link

MrLoh commented Sep 21, 2017

I'm also encountering this issue. No idea how to fix it, or where it suddenly came form.

@ruipaulo
Copy link

ruipaulo commented Sep 21, 2017

Product-> Clean and then rm -rf ~/Library/Developer/Xcode/DerivedData/* did the trick for me.

@i6mi6
Copy link

i6mi6 commented Nov 19, 2017

Cmd + Shift + K did it for me

@jgbaEmento
Copy link

same problem here ... cleaning and deleting derived data does not work here

@kasran15
Copy link

Product -> Clean did the trick. Good suggestion!

@pratt3351
Copy link

I’ve just delete project/ios/build folder and command react-native run-ios and it works fine!

@bonlemuel
Copy link

bonlemuel commented Dec 21, 2017

@rouge3351 Thanks for your solution. Saved me lots of time figuring it out. :)

@luco
Copy link

luco commented Dec 26, 2017

None of proposed fixes works for me.

@MrLoh
Copy link

MrLoh commented Dec 26, 2017

@luco did you really try all three things?

  • rm -rf ~/Library/Developer/Xcode/DerivedData/*
  • rm -rf ios/build
  • in xcode Cmd + Shift + K

Did you try building from xcode and command line

@DylanVann is there any chance you could look into fixing this in the code. This is sucha a terrible annoyance for everyone using this library and it happens regularly. I have no idea what has to be setup in xcode to make this disappear, but there must be something, as I haven't gotten these errors from any other library.

@luco
Copy link

luco commented Dec 27, 2017

@MrLoh Apparently doing this steps the error went away.
I'll be monitoring this. Thanks a lot!

@hoscarcito
Copy link

This is really annoying indeed.
I'm subscribing for news!

@broskoski
Copy link

broskoski commented Mar 1, 2018

Same problem here. Running Project -> Clean and wiping the derived data folder did not work for me. If it helps at all, my project is set up with CocoaPods (though I manually linked the library in the build phases).

@ruipaulo
Copy link

ruipaulo commented Mar 1, 2018

@broskoski Did you do all the above suggested steps in @MrLoh 's last comment?

@broskoski
Copy link

@ruipaulo thanks, yes I did.

@danmatthews
Copy link

Also had this problem and couldn't solve it by performing all of the above steps.

I'm on a detached expo project, which means that i don't have an ios/build folder, so i couldn't do that one.

Had to uninstall as it was preventing me from building entirely.

@DylanVann
Copy link
Owner

DylanVann commented Mar 18, 2018

  • node_modules (rm -rf node_modules then yarn)
  • watchman cache (watchman watch-del-all)
  • react-native packager cache (react-native start --reset-cache)
  • react native build (rm -rf ios/build)
  • xcode clean
  • xcode derived data

There are a lot of places things can get cached and mess things up when using React Native. Try clearing all those and I'm certain you won't have any more issues.

There's not really anything I could do to this library that would prevent these issues. I have dealt with these issues using many other libraries.

IMO React Native should have a clean command that handles all of these cases.

@ruipaulo
Copy link

@DylanVann I know, that it is probably super hard to find the bug that is causing this. On the other hand, it is happening consistently once or twice per week in our project. This is only and always caused by fast-image (we have also many other native libraries in the project). I know that there is probably no easy fix for this, but I think this issue should remain open as long as it is not fixed. Maybe at some point somebody might come up with a solution. This is a relevant bug, it is costing us at least an hour dev time per week and many users coming new to your library might spent hours trying to fix find a solution. This shouldn't be perceived as nagging, we love your library, but this is a relevant bug.

@foggy1
Copy link

foggy1 commented Mar 21, 2018

This happens in completely fresh build environments, e.g. when using continuous integration tools. It actually makes CI completely untenable with respect to iOS builds.

@DannyAlb
Copy link

DannyAlb commented Mar 22, 2018

I do not recommend doing this, but our extremely unacceptable and voodoo workaround was that after trying to build normally and getting above errors, to build the FastImage project separately, and add the library statically to the project (the libFastImage.a).

Unacceptable, voodoo, but the only way we got it to works :)

@brenwell
Copy link

brenwell commented Apr 6, 2018

I am wondering if the issue is caused because there is actually a duplicate?

Looks like its included twice.

I'm no xcode expert though

screen shot 2018-04-06 at 09 05 13

@hoscarcito
Copy link

As @foggy1 mention, this happens on fresh build environments, making it useless with CI tools.
@brenwell I saw the same but I don't understand how it works iOS nor why it works after cleaning the project.
Any light over here?

@tomauty
Copy link

tomauty commented Apr 18, 2018

@brenwell They are the same file. Not sure why it's included twice but if that could be resolved, all users here could finally check Parallelize Builds again...

@oferRounds
Copy link

+1

@DylanVann
Copy link
Owner

I'm looking into it a bit more. I have run into this.

I cannot replicate the issue on a new project though.

@brenwell
Copy link

The issue seems to come and go. Personally I find it easier to replicate via ‘react-native run-ios ‘ than via Xcode. Perhaps that helps

@DylanVann
Copy link
Owner

DylanVann commented Apr 22, 2018

I made some changes to the FastImage project that might fix this.

  • Set deprecated ALWAYS_SEARCH_USER_PATHS to NO. (e7ba4a7)
  • Fix FLAnimatedImage header search path. (883dc06)
  • Remove FLAnimatedImage from FastImage project since it's already included in SDWebImage. Installation remains the same as before when using CocoaPods. (a2d9fe2)

The changes are published as v4.0.4. Please let me know wether or not you're still experiencing this issue after upgrading.

@brenwell
Copy link

Awesome. Will check thanks

@VicFrolov
Copy link

Getting same issue on version 4.0.4

Removed build folder, removed node modules, cleared watchman, installed node modules, npm reset cache, deleted all derived data. cleared xcode cache. Not sure what else to do :/

@brenwell
Copy link

I haven't seen the issue since I upgraded to 4.0.4 that doesn't mean it won't appear though

For anyone interested here is my clean all the things script

# react-native
    watchman watch-del-all
    rm -rf node_modules && npm install
    rm -rf $TMPDIR/haste-map-react-native-packager-*
    rm -rf $TMPDIR/react-native-packager-cache-*
    rm -rf $TMPDIR/metro-bundler-cache-*

# xcode
    xcodebuild -project ios/vs2.xcodeproj -configuration Release clean
    xcodebuild -project ios/vs2.xcodeproj -configuration Debug clean
    rm -rf ~/Library/Developer/Xcode/DerivedData
    rm -f /ios/build

 # cocoapods
    pod deintegrate --project-directory=./ios/
    rm -rf ./ios/Pods
    pod install --project-directory=./ios/
@DylanVann
Copy link
Owner

There were some issues with v4.0.4, they should be resolved in the latest version (v4.0.6). See: #189

@Ingibjorg
Copy link

Thanks @DylanVann . This solved the issue for me 🙏

@schlaegerz
Copy link

I am on 4.0.8 and still getting this issue

@DylanVann
Copy link
Owner

You will probably still have this issue immediately after you upgrade to v4.0.8.

Do a clean build (xcode clean / rm -rf ios/build). I haven't seen this issue again since doing that.

@luco
Copy link

luco commented Jul 25, 2018

OK, I got this issue again and solved by doing a xcode clean and removing ios/build folder.

@duro
Copy link

duro commented Sep 25, 2018

@DylanVann we are seeing this on latest version of react-native-fast-image with React 0.57. Not sure if 0.57 has anything to do with it. The biggest problem is that we use CI to build our releases, which always start from a clean state. We are consistently getting the issue with every build.

One thing we have noticed is that another one of our dependencies, the Braze/Appboy SDK, also depends on SDWebImage.

Has any further light been shed on this issue? We are going crazy trying to make any progress on resolving this.

@dmkmedina
Copy link

@duro Did you find a way to resolve this with the braze/appboy sdk? we're also having a similar issue

@duro
Copy link

duro commented Oct 4, 2018

@dmkmedina: Pinging @theonetheycallneo as he was the one on our team who got it sorted out. I'll be honest, it wasn't straightforward.

@onurzorluer
Copy link

Xcode 10 has a new build system. I had same problem in Xcode 10. I found that switching to the Legacy Build Systems solved the problem.
To switch to the legacy build system do the following:

  • File -> Project/Workspace Settings...
  • Under Build System choose: Legacy Build System
@theonetheycallneo
Copy link

@dmkmedina Our solution wasn't ideal, but we forked the react-native-fast-image and stripped out their SDWebImage.framework, then had their iOS project inherit from our parent umbrella iOS project:
https://github.com/FreebirdRides/react-native-fast-image/commits/master

We then manually linked our parent iOS project to SDWebImage with Appboy's latest bundled release of SDWebImage.

Basically, we been manually linking frameworks on our umbrella, then we fork any conflicting libs and have them correctly inherit from the parent.

Hope that helps shed some light.

@bnap00
Copy link

bnap00 commented Nov 10, 2018

Currently, I am on

"react-native-firebase": "^5.1.0",

and I am facing

/node_modules/react-native-fast-image/ios/FastImage/FFFastImageView.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
@atereshkov
Copy link

Flutter:
Just press Cmd + Shift + K in Xcode and then rebuild it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet