Building React Native from source doesn't work
See original GitHub issueDescription
Building React Native from source doesn’t work
FIRMessagingModule.java:36: error: FIRMessagingModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
I’m pretty sure that gradle choose old react-native
version for react-native-fcm
Reproduction
react-native init AwesomeProject
- follow this article https://facebook.github.io/react-native/docs/android-building-from-source.html
npm install react-native-fcm --save
react-native link react-native-fcm
here https://github.com/skv-headless/rn-build-fail project with this steps.
exclude
should work but it doesn’t make any difference https://facebook.github.io/react-native/docs/android-building-from-source.html#4-making-3rd-party-modules-use-your-fork
All projects which behave same way set repositories { mavenCentral() }
inside their build.gradle
Solution
I’ve added to package.json
"postinstall": "find . -type f -name build.gradle -not -path \"*/react-native/*\" -not -path \"*/Examples/*\" -not -path \"*/examples/*\" -print0 -exec sed -i '' \"s/.*com.facebook.react:react-native:.*/ compile project(':ReactAndroid')/\" {} +"
but I don’t think it is the best solution.
Additional Information
- React Native version: [master, “facebook/react-native#01af9ee8a7ec8921590e4cac29bf14267b068ddc”]
- Platform: [Android]
- Operating System: [MacOS]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Same issue here. I suspect the issue is this chunk in build.gradle:
These files exist when a version is installed from npm but not in the forked react-native:
I couldn’t use this information to find a solution but maybe someone else can. You could add those files to your forked repo and then it would probably work but that doesn’t seem correct.
building RN from source works for us. Looking at your project here are some pointers:
remove this: https://github.com/skv-headless/rn-build-fail/blob/master/android/build.gradle#L20-L23
change the ordering and naming here https://github.com/skv-headless/rn-build-fail/blob/master/android/settings.gradle#L5-L8 to
If i remember correctly calling it ReactAndroid excluded RN dependency itself.