Skip to content

Don't reference null android.ndkDirectory in build.gradle #25088

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

Conversation

petterh
Copy link
Contributor

@petterh petterh commented May 30, 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

Test Plan

Manual testing. Ensure that the Android NDK is improperly referenced (it doesn't matter whether it's actually installed somewhere), then try to sync Android Studio's project with the Gradle files. This will fail with or without this change, but with the change, the developer gets a proper error message instead of an NRE.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner labels May 30, 2019
@react-native-bot react-native-bot added Platform: Android Android applications. Bug labels May 30, 2019
@thymikee thymikee requested a review from dulmandakh May 30, 2019 14:46
Copy link
Contributor

@ferrannp ferrannp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this locally and works as expected. Thank you!

Screenshot 2019-05-30 at 17 43 33

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @petterh in 2aca234.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 30, 2019
@petterh petterh deleted the petterh/issue-25087-improve-diagnostics branch May 31, 2019 05:04
@dulmandakh
Copy link
Contributor

dulmandakh commented May 31, 2019 via email

kelset pushed a commit that referenced this pull request 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 pull request 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Microsoft Partner: Microsoft Partner Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve build failure diagnostics when NDK is missing or incorrectly set up
6 participants