question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building React Native from source doesn't work

See original GitHub issue

Description

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

  1. react-native init AwesomeProject
  2. follow this article https://facebook.github.io/react-native/docs/android-building-from-source.html
  3. npm install react-native-fcm --save
  4. 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:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
farazscommented, Mar 8, 2017

Same issue here. I suspect the issue is this chunk in build.gradle:

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

These files exist when a version is installed from npm but not in the forked react-native: screen shot 2017-03-08 at 2 17 34 pm

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.

2reactions
chirag04commented, Dec 30, 2016

building RN from source works for us. Looking at your project here are some pointers:

    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile project(':react-native-android')
    compile project(':react-native-fcm')

If i remember correctly calling it ReactAndroid excluded RN dependency itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Build from Source - React Native
From the Welcome screen of Android Studio choose "Import project" and select the android folder of your app. You should be able to...
Read more >
Building React Native from source
You will need to build React Native from source if you want to work on a new feature/bug fix, try out the latest...
Read more >
Building React Native From Source (Android) | by Jono Allen
There are two options for this: build source from react native Github repo, or clone it down and link it with Yarn.
Read more >
React native android build from Source problem
I just use the last release version 0.63 which does not use codegen, and it works. One more thing that I encountered but...
Read more >
What Is React Native? Complex Guide for 2022 - Netguru
React Native was first released by Facebook as an open-source project in 2015. ... Knowledge of React won't be enough for iOS and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found