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

Android 14 Broadcast Receiver flag #37769

Closed
mvn-hungtruong-dn opened this issue Jun 8, 2023 · 15 comments
Closed

Android 14 Broadcast Receiver flag #37769

mvn-hungtruong-dn opened this issue Jun 8, 2023 · 15 comments
Labels
Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@mvn-hungtruong-dn
Copy link

Description

Android 14 requires the flag RECEIVER_NOT_EXPORTED or RECEIVER_EXPORTED when registerReceiver

Maybe related to this issue
#31870

React Native Version

0.71.10

Output of npx react-native info

System:
OS: macOS 13.4
CPU: (8) arm64 Apple M2
Memory: 55.25 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.0.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.6.4 - /opt/homebrew/bin/npm
Watchman: 2023.05.15.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 17.0.6 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.10 => 0.71.10
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Set targetSdkPreview and compileSdkPreview to UpsideDownCake and build an app for Android.
The application will be crashed immediately after opening.

Snack, code example, screenshot, or link to a repository

Screenshot 2023-06-08 at 17 25 28

@github-actions github-actions bot added the Platform: Android Android applications. label Jun 8, 2023
@cortinico cortinico changed the title Android UpsideDownCake Broadcast Receiver flag Android 14 Broadcast Receiver flag Jun 8, 2023
@cortinico
Copy link
Contributor

That's a valid report, thanks for sharing. We're tracking this and other Android 14 required tasks internally.

@LeonidKokhnovich
Copy link

LeonidKokhnovich commented Jun 26, 2023

Hi! My understanding it's a blocker for Android 14 support with RN integration. Do we need help to get a code change for this issue or there is already someone working on it? If yes, what's the timeline for this fix? Thank you!

@DaAitch
Copy link

DaAitch commented Jul 17, 2023

Same here.

  • RN: 0.71.2
  • updating compileSdkVersion and targetSdkVersion to API 34 (Android 14) for testing
  • java.lang.SecurityException for debug and release (in debug this error is nested in one of the "causes", but they are same)
buildscript {
    ext {
        // ...
        compileSdkVersion = 34 // Android 14
        targetSdkVersion = 34 // Android 14
        // ...
    }
}
java.lang.SecurityException: XYZ: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

@cortinico
Copy link
Contributor

Hi! My understanding it's a blocker for Android 14 support with RN integration. Do we need help to get a code change for this issue or there is already someone working on it? If yes, what's the timeline for this fix? Thank you!

@LeonidKokhnovich if you wish to send a PR, please do. We could backport it to 0.71/0.72 if needed

@StevenBarnett1
Copy link

StevenBarnett1 commented Jul 21, 2023

Im running into the same problem, app crashing on startup

        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')

Screen Shot 2023-07-20 at 9 27 11 PM

@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 21, 2023
@dominikwagner
Copy link

PR was merged #38256
Does anybody know when this will be available in a new release? Thanks!

@github-actions
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@cortinico
Copy link
Contributor

PR was merged #38256

Closing as for this

Does anybody know when this will be available in a new release? Thanks!

It will make it in 0.73 or you can ask for a backport in this working group:
https://github.com/reactwg/react-native-releases/discussions

@cortinico cortinico added Resolution: Fixed A PR that fixes this issue has been merged. and removed Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Jul 25, 2023
@dominikwagner
Copy link

Thanks!
I asked for a backport. Because this is blocking Android 14 support which is released next week. So I was wondering if there was a temporarily solution for this until there is a backport or a new release.

@cortinico
Copy link
Contributor

Because this is blocking Android 14 support which is released next week

Could you link the source of this statement?

@dominikwagner
Copy link

Could you link the source of this statement?

Sorry, it was just my conclusion after reading this thread, seeing the code changes in the PR and fighting with this problem for several hours while attempting to upgrade to Android 14

@dominikwagner
Copy link

Has anyone solved this problem without upgrading RN? We're currently using RN 0.69, and we haven't found a way to make it work with Android 14.

@DaAitch
Copy link

DaAitch commented Aug 12, 2023

@dominikwagner as long as you do not target a new Android version it should not break your running app, at least for while, so you have time to update RN.

@ThushalIntervest
Copy link

Does anyone know an alternative solution?

@renanzalheiros
Copy link

renanzalheiros commented Sep 25, 2023

Any ideia when (and version) this fix will be applied?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests

8 participants