-
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 (#20526)
Summary: Mirrors #17967 which was imported and reverted Original: 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 Pull Request resolved: #20526 Differential Revision: D9164762 Pulled By: hramos fbshipit-source-id: 544798a912df11c7d93070ddad5a535191cc3284
- Loading branch information
1 parent
7a0af55
commit da6a5e0
Showing
1 changed file
with
112 additions
and
116 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
da6a5e0
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.
Awesome!
da6a5e0
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.
Finally! This is great. Would love to see an NPM release as soon as possible.
da6a5e0
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.
When release this? I really need this. 👍
da6a5e0
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.
@yangga I guess 0.57.0
da6a5e0
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.
This is the prefect solution~
da6a5e0
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.
(pt-br) Muito bom. Estava a 2 dias procurando uma solução, e está resolveu perfeitamente. Muito obrigado.
Aguardo a 0.57 🥇
da6a5e0
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 installed RN 0.57.0-rc.0 on my project (currently on 0.56) to try & upgrade Gradle to 3.
When I finally got all my dependencies right, I tried to assemble a variant of my app :
bundle{Variant}JsAndAssets
works fine but I'm still getting an error at themerge{Variant}Resources
step :duplicate resources
for all my images from app/srv/main/res/drawable-{} folders.it seems this issue of duplicate ressources has been mentioned in other issues :-/
EDIT
My bad! duplicate resources were there from a previous attempt at bumping Gradle to 3. I removed the duplicate images from
app/srv/main/res/drawable-{}
folders, and the build succeeded !THANKS
da6a5e0
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.
Wow, this worked. Thanks a lot.
When do we get an official react native update though?
da6a5e0
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.
@tomiiide this is officially included on the latest release,
v0.57.1
da6a5e0
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.
@JCMais
I have updated my to "react-native": "0.57.1" and have run 'npm install'. I still getting the error about Duplicate resources. Could you please help me...