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

Improve build failure diagnostics when NDK is missing or incorrectly set up #25087

Closed
petterh opened this issue May 30, 2019 · 2 comments
Closed
Labels
Bug p: Microsoft Partner: Microsoft Partner Resolution: Locked This issue was locked by the bot.

Comments

@petterh
Copy link
Contributor

petterh commented May 30, 2019

If you (try to) build React Native for Android without having the NDK properly installed, you get the following error:

A problem occurred evaluating project ':ReactAndroid'.
> Cannot get property 'absolutePath' on null object

This is not an overly helpful diagnostic; what's wanted is this one:

ndk-build binary cannot be found, check if you've set $ANDROID_NDK environment variable correctly or if ndk.dir is setup in local.properties

I have a one-line fix and will submit a PR shortly.

React Native version: 0.59.8

System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
Memory: 1.83 GB / 15.93 GB
Binaries:
Node: 10.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156

Steps To Reproduce

  1. Clone react-native
  2. Run yarn
  3. Import into Android Studio (no NDK installed)
  4. Build

Describe what you expected to happen:

I would like the build failure to properly diagnose the missing NDK rather than throwing an NRE

@petterh
Copy link
Contributor Author

petterh commented May 30, 2019

@kelset
Copy link
Contributor

kelset commented May 30, 2019

omg yes pls! This is going to help so much 🙇‍♂️ Thanks :)

kelset pushed a commit that referenced this issue Jun 7, 2019
Summary:
If you (try to) build React Native for Android without having the NDK properly installed and referenced, you get the following error:

>A problem occurred evaluating project ':ReactAndroid'.
\> Cannot get property 'absolutePath' on null object

This is not an overly helpful diagnostic. This PR results in this message instead:

>ndk-build binary cannot be found, check if you've set $ANDROID_NDK environment variable correctly or if ndk.dir is setup in local.properties

Fixes #25087

## Changelog

[Android] [Fixed] - Show proper error message instead of throwing a NullReferenceException if Gradle cannot find the NDK
Pull Request resolved: #25088

Differential Revision: D15559271

Pulled By: cpojer

fbshipit-source-id: 35c9a9321af4e4a34bf519144ada48884b48352d
M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this issue Mar 10, 2020
…5088)

Summary:
If you (try to) build React Native for Android without having the NDK properly installed and referenced, you get the following error:

>A problem occurred evaluating project ':ReactAndroid'.
\> Cannot get property 'absolutePath' on null object

This is not an overly helpful diagnostic. This PR results in this message instead:

>ndk-build binary cannot be found, check if you've set $ANDROID_NDK environment variable correctly or if ndk.dir is setup in local.properties

Fixes facebook#25087

## Changelog

[Android] [Fixed] - Show proper error message instead of throwing a NullReferenceException if Gradle cannot find the NDK
Pull Request resolved: facebook#25088

Differential Revision: D15559271

Pulled By: cpojer

fbshipit-source-id: 35c9a9321af4e4a34bf519144ada48884b48352d
@facebook facebook locked as resolved and limited conversation to collaborators May 30, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug p: Microsoft Partner: Microsoft Partner Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants