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

Building React Native from source -> Project with path ':android-jsc' could not be found in project #22118

Closed
3 tasks done
MarkOSullivan94 opened this issue Nov 4, 2018 · 17 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@MarkOSullivan94
Copy link

MarkOSullivan94 commented Nov 4, 2018

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 7.19 GB / 32.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.12.0 - /usr/local/bin/node
      npm: 6.4.1 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3
        API Levels: 23, 25, 26, 27, 28
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
      react-native: github:MarkOSullivan94/react-native#master => 1000.0.0
    npmGlobalPackages:
      react-native-cli: 2.0.1

Description

Happened after I merged the latest changes for the React Native project into my forked version of it (with only changes to share functionality included there).

Reproducible Demo

  1. Create a new React Native project react-native init...
  2. Replace existing RN with my forked version
  3. Configure all the gradle files: build.gradle replacing the existing RN project with the forked one and settings.gradle so the forked project is included.
  4. Try and run the project react-native run-android

I have noticed that older versions of RN project used compile 'org.webkit:android-jsc:r174650' instead of compile project(':android-jsc') which is in the current master branch.

@gengjiawen
Copy link
Contributor

gengjiawen commented Nov 11, 2018

That's because we add 64bit cpu support.
We are currently doing some work to make react native fork more easily facebook/react-native-website#653.

@gengjiawen
Copy link
Contributor

gengjiawen commented Nov 11, 2018

For now you can try

docker run --rm --name rn-build -v $PWD:/pwd -w /pwd gengjiawen/react-native /bin/sh -c "./gradlew installArchives"

This may take a while, since it download the docker image and build all the things, after success, you can see something like this in root folder.

android
└── com
    └── facebook
        └── react
            └── react-native
                ├── 1000.0.0-master
                │   ├── react-native-1000.0.0-master.aar
                │   ├── react-native-1000.0.0-master.aar.md5
                │   ├── react-native-1000.0.0-master.aar.sha1
                │   ├── react-native-1000.0.0-master-javadoc.jar
                │   ├── react-native-1000.0.0-master-javadoc.jar.md5
                │   ├── react-native-1000.0.0-master-javadoc.jar.sha1
                │   ├── react-native-1000.0.0-master.pom
                │   ├── react-native-1000.0.0-master.pom.md5
                │   ├── react-native-1000.0.0-master.pom.sha1
                │   ├── react-native-1000.0.0-master-sources.jar
                │   ├── react-native-1000.0.0-master-sources.jar.md5
                │   └── react-native-1000.0.0-master-sources.jar.sha1
                ├── maven-metadata.xml
                ├── maven-metadata.xml.md5
                └── maven-metadata.xml.sha1

Then remove /android/ in .gitignore.
Also in this way you need not to hack around native dependency like react-native-image-crop-picker.

@gengjiawen
Copy link
Contributor

Also you need this patch #22293.

@MarkOSullivan94
Copy link
Author

I tried running the docker command and I received the following message

Unable to find image 'gengjiawen/react-native:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/gengjiawen/react-native/manifests/latest: unauthorized: incorrect username or password.
See 'docker run --help'.

@gengjiawen
Copy link
Contributor

Looks like you have some network issue.

@MarkOSullivan94
Copy link
Author

I've just copied and pasted exactly what you told me to run. I have no idea what I should do next.

@gengjiawen
Copy link
Contributor

gengjiawen commented Dec 1, 2018

can you try run it on ci ? Circle ci can use ssh debug.

@gengjiawen
Copy link
Contributor

You can also try docker run --rm -it node:11 bash -c "node -p process.versions" to test docker work properly on your machine. If this still not works, there is little I can help since I don't know your network issue.

@MarkOSullivan94
Copy link
Author

Yeah that didn't work either. I've never used docker before so I'm not sure if there's any additional steps I need to take to make it work on my machine for RN.

can you try run it on ci ? Circle ci can use ssh debug.

I'm not sure I follow. I don't have Circle CI.

@gengjiawen
Copy link
Contributor

You may need check the basic tutorial about docker. It likes git for me. You will love it.

@MarkOSullivan94
Copy link
Author

Okay turns out that I was getting that error message because I was logged in with my email and not my username. Odd.

@gengjiawen where do I run that docker command? In the root level in my fork of the RN project?

@gengjiawen
Copy link
Contributor

yeap.

@MarkOSullivan94
Copy link
Author

MarkOSullivan94 commented Dec 1, 2018

Okay it's currently downloading. Thank you!

What do you mean by this:

Also in this way you need not to hack around native dependency like react-native-image-crop-picker.

Curious what you mean exactly.

@gengjiawen
Copy link
Contributor

Like this #21776 (comment)

@MarkOSullivan94
Copy link
Author

Ah yeah I already had that setup in the project.

Initially had issues with the RN build.gradle file, specifically this section: https://github.com/MarkOSullivan94/react-native/blob/master/ReactAndroid/build.gradle#L6

Had to fix it by removing two of the plugins from that section and using apply plugin instead.

plugins {
    id("maven")
}

apply plugin: 'com.android.library'
apply plugin: 'de.undercouch.download'

After that I was shown this error message

> Task :react-native-android:prepareJSC FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '.../ReactNativeShareExample/node_modules/react-native/ReactAndroid/build.gradle' line: 165

* What went wrong:
Execution failed for task ':react-native-android:prepareJSC'.
> Expected configuration ':react-native-android:compile' to contain exactly one file, however, it co
ntains no files.

@gengjiawen
Copy link
Contributor

Don't remove them. And sync with upstream again as I mentioned earlier.

@hramos
Copy link
Contributor

hramos commented Feb 11, 2019

Looks like this can be closed?

The JSC in Android was updated in December, it's in master now.

@hramos hramos closed this as completed Feb 11, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Feb 11, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants