MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.11k stars 1.09k forks source link

Update Android SDK to API Level 34 #10260

Open sethkfman opened 2 months ago

sethkfman commented 2 months ago

What is this about?

Your highest non-compliant target API level is Android 13 (API level 33).

To ensure that you can continue to make updates to your app you must:

Update your app to target Android 14 (API level 34) or higher. Publish a new version of your app to production. Before you do this, you can test your app using internal, closed, or open testing. Go to Releases overview

Once you've done this, we'll send you an Inbox message to confirm that your app update was successful, and that your app is no longer affected.

For more information:

Learn more about the requirements Learn how to update your app Learn what changes you may need to make in your app Read the policy announcement

Scenario

No response

Design

No response

Technical Details

No response

Threat Modeling Framework

No response

Acceptance Criteria

No response

Stakeholder review needed before the work gets merged

References

No response

sethkfman commented 1 month ago

10352

sethkfman commented 1 month ago

https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

joaoloureirop commented 1 month ago

To target Android 14 we need to update react-native to 0.73.x

Our current version 0.72.15 targets Android 13 (API Level 33)

https://github.com/facebook/react-native/blob/4cee0a4c06deb3b49c31021ea50766a4d391de1e/packages/react-native/ReactAndroid/build.gradle#L435

Android 14 support was added on react-native 0.73

https://github.com/facebook/react-native/issues/45773#issuecomment-2255726667

https://github.com/facebook/react-native/blob/1eb4bf0d3af1fe267f5de6bf4bbe1e65d41fea1b/packages/react-native/ReactAndroid/src/main/AndroidManifest.xml#L12

joaoloureirop commented 1 month ago

solution to try: https://github.com/facebook/react-native/issues/41288#issuecomment-2241527680

ThalesBMC commented 1 month ago

solution to try: facebook/react-native#41288 (comment)

This solution solved the problem for me.

joaoloureirop commented 1 month ago

Another report of successful fix https://github.com/doublesymmetry/react-native-track-player/issues/2327#issuecomment-2241046437

solution to try: facebook/react-native#41288 (comment)

Applied fix. App still crashes on Pixel 8 test device running Android 14

ThalesBMC commented 1 month ago

@joaoloureirop Not sure if it will help you, but one thing that was causing me problems was that my Android app was not recognizing the number 34 in this solution that you tried.

Try this:

@Override
public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilter filter) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
        return super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED);
    } else {
        return super.registerReceiver(receiver, filter);
    }
}
joaoloureirop commented 1 month ago

Thanks @ThalesBMC

I rebuilt the app and it now registers the broadcast receiver correctly