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] fix cleanReactNdkLib task failure caused by module not found #7935

Closed
wants to merge 1 commit into from
Closed

Conversation

xinthink
Copy link
Contributor

@xinthink xinthink commented Jun 5, 2016

The clean task always fail due to the failure of the cleanReactNdkLib task, error messages:

:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting.    .  Stop.
:ReactAndroid:cleanReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 9.059 secs

Fixed it by specifying the location of Application.mk and THIRD_PARTY_NDK_DIR, same as the buildReactNdkLib task.

@ghost
Copy link

ghost commented Jun 5, 2016

By analyzing the blame information on this pull request, we identified @cjhopman and @mkonicek to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jun 5, 2016
@belemaire
Copy link

belemaire commented Jun 6, 2016

I ran into the exact same issue today and came up with a similar fix before noticing this pull request.

That being said, here are a few remarks that should be considered:

  • In the cleanReactNdkLib task, the path is set to src/main/jni/react/jni whereas for the buildReactNdkLib task, the path is set to src/main/jni/xreact/jni (react vs xreact). I am not very familiar with how things are done under the hood but that caught my eye as I would expect no difference of path between build/clean tasks (b.t.w if changing to xreact as for the build task, the cleanReactNdkLib tasks succeeds as well. so which path to use ?).
  • While this fix does help, it unfortunately does not fully solve the issue. Indeed, from the root react-native folder if you run ./gradlew :ReactAndroid:buildReactNdkLib, you can then run the clean task ./gradlew :ReactAndroid:cleanReactNdkLib as many times as you want and it will work (idempotent). However if you run the global clean task ( i.e ./gradlew :ReactAndroid:clean) after a build (through ./gradlew :ReactAndroid:buildReactNdkLib or a more general task such as ./gradlew :ReactAndroid:installArchives), you can run it only a single time. If you try to run it again, without doing a build first, it will fail (Cannot find module with tag 'folly' in import path) (not idempotent). It seems like the global clean is cleaning out some stuff that the cleanReactNdkLib task is looking out for ;)

Don't have too much time to look deeper into this atm unfortunately but just wanted to give out some things I noticed.

@ghost
Copy link

ghost commented Jul 5, 2016

It's been a while since the last commit was reviewed and the labels show this pull request needs review. Based on the blame information for the files in this pull request we identified @cjhopman as a potential reviewer. Could you take a look please or cc someone with more context?

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 12, 2016
@bestander
Copy link
Contributor

Is this still relevant?
I think we have done a fix to the bridge gradle script recently

@corbt
Copy link
Contributor

corbt commented Jul 28, 2016

I ran into this issue in the last week when trying to clean my project on the 0.31-stable branch.

@bestander
Copy link
Contributor

@facebook-github-bot shipit

@bestander
Copy link
Contributor

Thanks, good job, guys

@ghost ghost added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Jul 30, 2016
@ghost
Copy link

ghost commented Jul 30, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review internal test results.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 30, 2016
@ghost ghost closed this in 37df151 Jul 30, 2016
leeight added a commit to leeight/react-native that referenced this pull request Jul 30, 2016
bartolkaruza pushed a commit to immidi/react-native that referenced this pull request Aug 3, 2016
Summary:
The `clean` task always fail due to the failure of the `cleanReactNdkLib` task, error messages:

```
:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting.    .  Stop.
:ReactAndroid:cleanReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info
Closes facebook#7935

Differential Revision: D3646120

Pulled By: bestander

fbshipit-source-id: c869ff4a2d3407643fdeec431f454071747eb429
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
The `clean` task always fail due to the failure of the `cleanReactNdkLib` task, error messages:

```
:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting.    .  Stop.
:ReactAndroid:cleanReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info
Closes facebook#7935

Differential Revision: D3646120

Pulled By: bestander

fbshipit-source-id: c869ff4a2d3407643fdeec431f454071747eb429
@konark-hike
Copy link

konark-hike commented Nov 12, 2016

Am still facing this issue "Cannot find module with tag 'folly' in import path" on React 0.36 on jenkins build server, someone please guide for a solution related to the same

@rishabhpoddar
Copy link

@belemaire, what you described above is exactly whats happening to me. I am using RN 0.45.1, mac OS Sierra and Android Studio 2.3.3.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants