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

lazy configure ReactAndroid gradle tasks #26314

Closed
wants to merge 4 commits into from

Conversation

dulmandakh
Copy link
Contributor

Summary

ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from android when it wasn't configured completely.

extensionSupplier.get()!!.compileSdkVersion must not be null

or

compileSdkVersion is not specified.

It is happening because buildReactNdkLib task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from android when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks

Test Plan

./gradlew ReactAndroid:tasks run without errors, while master throws exception.

@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. Contributor A React Native contributor. labels Sep 3, 2019
@react-native-bot react-native-bot added the Platform: Android Android applications. label Sep 3, 2019
@dulmandakh
Copy link
Contributor Author

@friederbluemle @gengjiawen please review

@friederbluemle
Copy link
Contributor

Awesome, it's working for me locally! 👍 Thanks @dulmandakh 🎉

@dulmandakh
Copy link
Contributor Author

@friederbluemle please approve it if it worked 😉

Copy link
Contributor

@mdvacca mdvacca left a comment

Choose a reason for hiding this comment

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

accepting and landing it

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.

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

Copy link
Contributor

@friederbluemle friederbluemle left a comment

Choose a reason for hiding this comment

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

👍

@dulmandakh
Copy link
Contributor Author

@mdvacca any news?

@mdvacca
Copy link
Contributor

mdvacca commented Sep 5, 2019

trying one more time...

facebook-github-bot pushed a commit that referenced this pull request Sep 6, 2019
Summary:
Gradle wrapper `5.6.2`

Supersedes and closes #26227

## Changelog

[Android] [Changed] - Gradle wrapper 5.6.2
Pull Request resolved: #26349

Test Plan: Builds successfully (just like the current `master` branch, **only** after either reverting 4763000 **or** cherry-picking 7f23878 from #26314)

Differential Revision: D17224299

Pulled By: mdvacca

fbshipit-source-id: cbd1b3d5d686e284fdc8e3f6faaeaa93654b301d
@mdvacca
Copy link
Contributor

mdvacca commented Sep 6, 2019

@dulmandakh this PR keeps failing with the following error:

  • What went wrong:
    Could not determine the dependencies of task ':ReactAndroid:packageReactNdkLibs'.

Could not create task ':ReactAndroid:buildReactNdkLib'.
NDK is not installed

I think the change from Line 213 is affecting the build?

@friederbluemle
Copy link
Contributor

@mdvacca - Which task are you running that is failing?

@dulmandakh
Copy link
Contributor Author

@mdvacca please make sure that you have NDK installed and ANDROID_NDK environment variable points to it.

@dulmandakh
Copy link
Contributor Author

@mdvacca the :ReactAndroid:buildReactNdkLib task works as expected if NDK is set

@dulmandakh
Copy link
Contributor Author

@cpojer please merge

@dulmandakh
Copy link
Contributor Author

@mdvacca @cpojer please review and merge. I'm working on other gradle improvements, and I need it.

@friederbluemle
Copy link
Contributor

I just tested this again, and it (still) works. 👍

@cpojer
Copy link
Contributor

cpojer commented Sep 18, 2019

@dulmandakh CI is failing with the same error @mdvacca mentioned above. Could you fix that first?

@dulmandakh
Copy link
Contributor Author

@cpojer sorry, fixed. I'm working to add Gradle builds to CI #26482

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.

Let's try it.

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 @dulmandakh in 7c8e266.

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 Sep 18, 2019
vovkasm pushed a commit to vovkasm/react-native that referenced this pull request Sep 19, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
(cherry picked from commit 7c8e266)
ide pushed a commit to expo/react-native that referenced this pull request Oct 4, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
ide pushed a commit to expo/react-native that referenced this pull request Oct 4, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
ide pushed a commit to expo/react-native that referenced this pull request Oct 12, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
@dulmandakh dulmandakh deleted the lazy-gradle-tasks branch October 15, 2019 05:13
dustinyoste pushed a commit to dustinyoste/react-native that referenced this pull request Nov 1, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
sjchmiela pushed a commit to expo/react-native that referenced this pull request Nov 12, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
sjchmiela pushed a commit to expo/react-native that referenced this pull request Nov 13, 2019
Summary:
ReactAndroid Gradle was failing mysteriously with error below, because it was trying to read values from **android** when it wasn't configured completely.

```java
extensionSupplier.get()!!.compileSdkVersion must not be null
```

or

```java
compileSdkVersion is not specified.
```

It is happening because **buildReactNdkLib** task was created and configured eagerly. So this PR changes some tasks to be configured lazily, and reads values from **android** when ready. Also remove ANDROID_NDK variable check because android gradle plugin doing it automatically.

## Changelog

[Android] [Changed] - lazily configure ReactAndroid gradle tasks
Pull Request resolved: facebook#26314

Test Plan: ./gradlew ReactAndroid:tasks run without errors, while master throws exception.

Differential Revision: D17177945

Pulled By: cpojer

fbshipit-source-id: c7a165092157d2059f946da70b801d1a475d4b8c
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. Contributor A React Native contributor. Merged This PR has been merged. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants