-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better Android Gradle Plugin 3.x integration
Summary: Better integration with the Android Gradle-based build process, especially the changes introduced by the [Android Gradle Plugin 3.x and AAPT2](https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html). Fixes #16906, the `android.enableAapt2=false` workaround is no longer required. Bases the task generation process on the actual application variants present in the project. The current manual process of iterating build types and product flavors could break down when more than one dimension type is present (see https://developer.android.com/studio/build/build-variants.html#flavor-dimensions). This also exposes a very basic set of properties in the build tasks, so that other tasks can more reliably access them: ```groovy android.applicationVariants.all { variant -> // This is the generated task itself: def reactBundleTask = variant.bundleJsAndAssets // These are the outputs by type: def resFileCollection = reactBundleTask.generatedResFolders def assetsFileCollection = reactBundleTask.generatedAssetsFolders } ``` I've tested various combinations of product flavors and build types ([Build Variants](https://developer.android.com/studio/build/build-variants.html)) to make sure this is consistent. This is a port of what we're currently deploying to our CI process. [ ANDROID ] [ BUGFIX ] [ react.gradle ] - Support Android Gradle Plugin 3.x and AAPT2 [ ANDROID ] [ FEATURE ] [ react.gradle ] - Expose the bundling task and its outputs via ext properties Closes #17967 Differential Revision: D7017148 Pulled By: hramos fbshipit-source-id: e52b3365e5807430b9caced51349abf72332a587
- Loading branch information
1 parent
5447ca6
commit d16ff3b
Showing
1 changed file
with
102 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d16ff3b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting
with this patch when using gradle 2.14.1, updating is not really possible since a lot of third party modules don't support the latest gradle version as well as react native itself (building from source).
d16ff3b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janicduplessis have you tried updating the gradle version of those plugins? They should all have a build.gradle file:
node_modules/<plugin>/build.gradle
The gradle version should be listed within buildscript -> dependencies
In my case
There's no reason why any plugin should stop working after updating to the same gradle version as your project
d16ff3b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janicduplessis on the contrary, majority of Android projects use Android tools version 3.x and that requires you to be on not-so-old Gradle version.
This commit made it possible for us to integrate ReactNative in our app.
I am not sure just reverting is a wise idea without any plan to make this happen.
d16ff3b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RN now builds fine with gradle@3 so we could land this again.
d16ff3b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use this solution do i have to just modify
node_modules/react-native/react.gradle
adding these changes?