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

Fix crash on release versions after AGP 7.3 bump #34797

Closed
wants to merge 1 commit into from

Conversation

cortinico
Copy link
Contributor

Summary

Release versions are currently broken on main. This happened once we bumped the AGP version to 7.3. It seems like that the path we used to use for assets has changed.

The app build successfully but it fails to start as it can't load the bundle.

This is also causing the hermes e2e test to fail: facebook/hermes#821

Changelog

[Android] [Fixed] - Fix crash on release versions after AGP 7.3 bump

Test Plan

Tested this locally and it works fine with RN Tester (can run a release version of it).

Plus, inspecting the zip:

Before

$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/mergeHermesReleaseAssets/RNTesterApp.android.bundle

After

$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/RNTesterApp.android.bundle

@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. p: Facebook Partner: Facebook Partner labels Sep 27, 2022
@react-native-bot react-native-bot added Bug Platform: Android Android applications. labels Sep 27, 2022
@facebook-github-bot
Copy link
Contributor

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @cortinico in 6125f1f.

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 27, 2022
@yungsters yungsters deleted the nc/fix-broken-release-versions branch September 29, 2022 16:16
@mattijsf
Copy link
Contributor

Thanks for this. I updated from 7.2.1 to 7.3.1 and ran into this. React Native 0.70.3 still does not have this patch included so for now used patch-package to make it work.

@cortinico
Copy link
Contributor Author

Thanks for this. I updated from 7.2.1 to 7.3.1 and ran into this. React Native 0.70.3 still does not have this patch included so for now used patch-package to make it work.

I would highly encourage you to don't use patch-package. What's the reason why you bumped AGP to 7.3?

@mattijsf
Copy link
Contributor

I thought it was needed due to a library that I included that relies on the newest kotlin version. Android Studio complained that it requires a more recent version of the gradle plugin.

@cortinico
Copy link
Contributor Author

I thought it was needed due to a library that I included that relies on the newest kotlin version. Android Studio complained that it requires a more recent version of the gradle plugin.

Nope it's not. Android Studio is really eager in asking you to always update AGP, resulting in actually breaking your project sadly :/ I'm investigating if we can turn off those dialogs for React Native projects by hiding the AGP version.

@hotaryuzaki
Copy link

i got this issue this week, I upgraded RN to 0.70.7 and set buildToolsVersion to 33 because I make postnotifications permission requests for Android 13.
When I build, there is a strong warning that suggests I update Gradle to a version higher than 7.2.1, so i set 7.3.1
Then the app will crash when opening either AAB or APK.

My temporary solution is downgrade to 7.2.1

@cortinico
Copy link
Contributor Author

i got this issue this week, I upgraded RN to 0.70.7 and set buildToolsVersion to 33 because I make postnotifications permission requests for Android 13. When I build, there is a strong warning that suggests I update Gradle to a version higher than 7.2.1, so i set 7.3.1 Then the app will crash when opening either AAB or APK.

My temporary solution is downgrade to 7.2.1

Or you can update React Native to 0.71 which has supports for this out of the box

@hotaryuzaki
Copy link

i got this issue this week, I upgraded RN to 0.70.7 and set buildToolsVersion to 33 because I make postnotifications permission requests for Android 13. When I build, there is a strong warning that suggests I update Gradle to a version higher than 7.2.1, so i set 7.3.1 Then the app will crash when opening either AAB or APK.
My temporary solution is to downgrade to 7.2.1

Or you can update React Native to 0.71 which has support for this out of the box

My app is a bare expo and the SDK version is currently 47. maybe I need to hold it until I upgrade to SDK 48.

OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Release versions are currently broken on `main`. This happened once we bumped the AGP version to 7.3. It seems like that the path we used to use for assets has changed.

The app build successfully but it fails to start as it can't load the bundle.

This is also causing the hermes e2e test to fail: facebook/hermes#821

## Changelog

[Android] [Fixed] - Fix crash on release versions after AGP 7.3 bump

Pull Request resolved: facebook#34797

Test Plan:
Tested this locally and it works fine with RN Tester (can run a release version of it).

Plus, inspecting the zip:

### Before

```
$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/mergeHermesReleaseAssets/RNTesterApp.android.bundle
```

### After

```
$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/RNTesterApp.android.bundle
```

Reviewed By: cipolleschi

Differential Revision: D39847369

Pulled By: cortinico

fbshipit-source-id: 0e21c0b6e58b49ac097c59223649b74b2879b5e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Facebook Partner: Facebook Partner Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants