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

[0.71] Release of React Native 0.71 is currently blocked by an AGP stable release #35592

Closed
cortinico opened this issue Dec 7, 2022 · 8 comments
Labels

Comments

@cortinico
Copy link
Contributor

cortinico commented Dec 7, 2022

Description

Hey all,
I'm opening this issue to track the current status of a blocker for the release of React Native 0.71.x. We'll use this issue to track the status and decide what to do next.

The problem

We're about to ship 0.71.0 with a version of AGP (Android Gradle Plugin) which is 7.4.0-beta05, the last known version of AGP that is working with the current setup of React Native.

classpath("com.android.tools.build:gradle:7.4.0-beta05")

This has the unfortunate side effect that users will be able to open newly created projects only inside Android Studio Electric Eel version 7.4.0-beta05. When opening such a project with a different version of Android Studio (say 7.4.0 stable), they'll be prompted to "update" their Android project to the corresponding version, resulting in a build failure.

Overview of AGP versions

Specifically, the offending API is the addGeneratedSourceDirectory method used to inject the JS bundle and the static asset inside the final APK:

variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir)

We've been investigating AGP versions and if we can use another non-broken versions of AGP. Here an overview.

  • 7.2.x -> Unusable as the addGeneratedSourceDirectory was not there
  • 7.3.x -> Unusable as addGeneratedSourceDirectory is broken for resources. This was causing Static images are not rendered on Android for 0.71.0-rc.0 #35439 on our previous RC. A fix has been shipped by Google's, and is available in 7.4. I’ve asked for a backport of the fix in 7.3 but it seems like there are no more 7.3.x releases planned.
  • 7.4.0-beta05 -> That’s the last AGP version where this API is working (the one we're about to ship).
  • 7.4.0-rc01 -> Unusable as addGeneratedSourceDirectory got broken inside RC01. I’ve reported the issue and got it fixed (which is great!)
  • 7.4.0 -> Unusable as the fix for the broken API won’t land in .0 but we’ll have to wait for 7.4.1 apparently.
  • 7.4.1 -> Seems like we’ll have to wait for this version (sadly we don’t have an ETA from Google's end on this).

Version

0.71.0

@cortinico
Copy link
Contributor Author

I'm investigating the feasibility of not invoking:

variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)

entirely as it's broken, pass and hardcoded resourcesDir similar to what we were doing in 0.70.x and use AGP 7.3.1 at least to unblock the release.

@Smarking

This comment was marked as off-topic.

@Smarking

This comment was marked as off-topic.

cortinico added a commit to cortinico/react-native that referenced this issue Dec 13, 2022
Summary:
Fixes facebook#35592
I'm de-bumping AGP from 7.4 to 7.3 as per facebook#35592. There is no stable release
of AGP that is working fine with the `addGeneratedSourceDirectory` API for resources.
Here I'm reverting to use the older APIs.

Changelog:
[Internal] [Changed] - De-bump AGP to 7.3.1 and do not use `addGeneratedSourceDirectory`

Differential Revision: D42004813

fbshipit-source-id: d35bcb0b5d9d9b2c6b096d5566d2d6f2187d836e
@cortinico
Copy link
Contributor Author

We ended up de-bumping AGP to 7.3 to unblock the release of RN 0.71 as Google is not providing any ETA on AGP 7.4 and the current releases are all broken.

The de-bump is circumventing the broken APIs on AGP 7.3 so we should be good to go.
This will also allow to open RN projects on .71 with both Android Studio Electric Eel and Dolphin.

@kelset
Copy link
Collaborator

kelset commented Dec 14, 2022

(the commit will land in 0.71 RC5)

cipolleschi pushed a commit that referenced this issue Dec 19, 2022
…5631)

Summary:
Pull Request resolved: #35631

Fixes #35592
I'm de-bumping AGP from 7.4 to 7.3 as per #35592. There is no stable release
of AGP that is working fine with the `addGeneratedSourceDirectory` API for resources.
Here I'm reverting to use the older APIs.

Changelog:
[Internal] [Changed] - De-bump AGP to 7.3.1 and do not use `addGeneratedSourceDirectory`

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D42004813

fbshipit-source-id: f1a2b0f7c2233402749a3e4f3828be80111ad3a7
@cortinico
Copy link
Contributor Author

Just a heads up that Google released AGP 7.4.1 which fixes the bug with addGeneratedSourceDirectory and we're bumping it in:

@androideveloper
Copy link

Hi @cortinico! Thanks for the update here. Any known issues when running RN 0.70 with AGP 7.4.1?

@cortinico
Copy link
Contributor Author

Any known issues when running RN 0.70 with AGP 7.4.1?

We haven't tested it so that's not recommended.

OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this issue May 22, 2023
…cebook#35631)

Summary:
Pull Request resolved: facebook#35631

Fixes facebook#35592
I'm de-bumping AGP from 7.4 to 7.3 as per facebook#35592. There is no stable release
of AGP that is working fine with the `addGeneratedSourceDirectory` API for resources.
Here I'm reverting to use the older APIs.

Changelog:
[Internal] [Changed] - De-bump AGP to 7.3.1 and do not use `addGeneratedSourceDirectory`

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D42004813

fbshipit-source-id: f1a2b0f7c2233402749a3e4f3828be80111ad3a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants