software-mansion / react-native-screens

Native navigation primitives for your React Native app.
MIT License
3.01k stars 510 forks source link

Crashing when updating android to api target 35 #2257

Closed corbella83 closed 1 month ago

corbella83 commented 1 month ago

Description

All versions of "react-native-screens" are crashing when targeting android app to api level 35 due to NoSuchMethodError:

java.lang.NoSuchMethodError: No interface method removeLast()Ljava/lang/Object; in class Ljava/util/List; or its super classes (declaration of 'java.util.List' appears in /apex/com.android.art/javalib/core-oj.jar) at com.swmansion.rnscreens.ScreenStack.obtainDrawingOp(ScreenStack.kt:319) at com.swmansion.rnscreens.ScreenStack.drawChild(ScreenStack.kt:303) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4538)

Is this line: if (drawingOpPool.isEmpty()) DrawingOp() else drawingOpPool.**removeLast**()

And means that removeLast is not available anymore. Replacing it to this works well:

if (drawingOpPool.isEmpty()) DrawingOp() else drawingOpPool.removeAt(drawingOpPool.size - 1)

This is a known issue from android: official android documentation

Steps to reproduce

  1. Create a react-native project CLI, using 0.74.3 and add dependency of react-native-screens 3.32.0
  2. Configure compileSdkVersion and targetSdkVersion of the android project to use api level 34
  3. Execute android app and ensure everything is working
  4. Change compileSdkVersion and targetSdkVersion to use api level 35
  5. Execute android app and it will crash

Screens version

3.32.0

React Native version

0.74.3

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

None

Device

Real device

Device model

Samsung Galaxy S22

Acknowledgements

Yes

github-actions[bot] commented 1 month ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] commented 1 month ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

corbella83 commented 1 month ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

I'm not going to create a new project, configure it, and upload to github for that small change. Every project you have installed will behave the same if you use android api level35. PR https://github.com/software-mansion/react-native-screens/pull/2256