mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix for resources not correctly bundlded on release appbundles (#35872)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35872 When downgrading from AGP 7.4 to 7.3 we were forced to resort to older APIs to bundle resources. It seems like we haven't properly wired the task to make sure resources generated by Metro are correctly accounted before the generation of release app bundles/apks. This fixes it. This fix can also be removed once we are on AGP 7.4 Fixes #35865 Changelog: [Android] [Fixed] - Fix for resources not correctly bundlded on release appbundles Reviewed By: cipolleschi Differential Revision: D42573450 fbshipit-source-id: a810924315f72e02e4c988ae86112bf0a06a9ce5
This commit is contained in:
committed by
Lorenzo Sciandra
parent
e4051c66fa
commit
1d64766c32
+10
-3
@@ -61,9 +61,16 @@ class ReactPlugin : Plugin<Project> {
|
||||
// This registers the $buildDir/generated/res/react/<variant> folder as a
|
||||
// res folder to be consumed with the old AGP Apis which are not broken.
|
||||
project.extensions.getByType(AppExtension::class.java).apply {
|
||||
this.applicationVariants.all {
|
||||
it.registerGeneratedResFolders(
|
||||
project.layout.buildDirectory.files("generated/res/react/${it.name}"))
|
||||
this.applicationVariants.all { variant ->
|
||||
val isDebuggableVariant =
|
||||
extension.debuggableVariants.get().any { it.equals(variant.name, ignoreCase = true) }
|
||||
val targetName = variant.name.replaceFirstChar { it.uppercase() }
|
||||
val bundleTaskName = "createBundle${targetName}JsAndAssets"
|
||||
if (!isDebuggableVariant) {
|
||||
variant.registerGeneratedResFolders(
|
||||
project.layout.buildDirectory.files("generated/res/react/${variant.name}"))
|
||||
variant.mergeResourcesProvider.get().dependsOn(bundleTaskName)
|
||||
}
|
||||
}
|
||||
}
|
||||
configureCodegen(project, extension, isLibrary = false)
|
||||
|
||||
Reference in New Issue
Block a user