react-native-screens: Task :react-native-screens:compileReleaseKotlin FAILED

Description

When doing a gradlew clean assembleRelease to get .aab file of my react-native appI get the following:

> Task :react-native-screens:compileReleaseKotlin FAILED
e: org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression in (15,47) in C:/xampp/htdocs/WOO!/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/SearchViewFormatter.kt

Attachments:
causeThrowable
java.io.FileNotFoundException: C:\xampp\htdocs\WOO!\node_modules\react-native-screens\android\build\intermediates\compile_r_class_jar\release\R.jar!/node_modules/react-native-screens/android/build/intermediates/compile_r_class_jar/release/R.jar!/com/swmansion/rnscreens/R.class

And:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-screens:compileReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

It seems .jar file seems missing, this started happening after I changed my app package name (I think…)

I tried upgrading kotlin version to 1.8.0 inside build.gradle but still getting the same error.

kotlinVersion = "1.8.0" //added this inside ext
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0" //added this inside dependencies

My package.json file

"react-native": "0.68.5",
"react-native-screens": "^3.19.0"

I have been stuck with this for a while, I can’t uninstall react-native-screens library since react-narive-navigation has a dependency on it (it seems)

Steps to reproduce

  1. Changed package name of my app from com.appname tp com.enterprisename.packagename
  2. did a gradlew clean assembleRelease to get .aab file
  3. App fails to build when it gets to react-native-screens (error seems to be related to kotlin)

Snack or a link to a repository

https://stackoverflow.com/questions/75404806/react-native-cant-get-release-bundle-because-react-native-screens-kotlin-error

Screens version

3.19.0

React Native version

0.68.5

Platforms

Android

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Release mode

Device

Real device

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

I had same issue when compiling android, I solved it by this method https://www.youtube.com/watch?v=7Fhp_1ZxQeg&ab_channel=SgtSam

This version helped for me to resolve this isuue after 8 hours 🤍❤️

"react-native-screens": "3.27.0",

I had a similar screens:compileReleaseKotlin failure with:

react-native-screens@3.22.0 react-native@0.71.7 ext.kotlinVersion = ‘1.8.21’ Bumping to Kotlin to 1.8.21 resolved this for me.I had a similar screens:compileReleaseKotlin failure with:

if it happened after name change, go to mainactivity,kt mainapplication.kt files and at top change your old package name with new one. it should resolve the problem. also update react-native rename global pkg so you dont face this problem again

I had a similar screens:compileReleaseKotlin failure with:

  • react-native-screens@3.20.0
  • react-native@0.64.4
  • ext.kotlinVersion = '1.3.50'

Bumping to Kotlin to 1.6.21 resolved this for me.

Estava atuando em um projeto expo 48, que estava gerando build com android 33, precisava alterar o android para 34 e estava obtendo esse erro ao buildar. Com a alteração do kotlinVersion de 1.8.10 obtive sucesso. Tanto a alteração do kotlinVersion para 1.0.21 quanto para 1.6.21 foram bem sucedidas.

“react-native”: “0.71.14”; “Expo”: “~48.0.21”; “react-native-screens”: “^3.34.0”;

Hey! 👋

This is the version we use inside the library and test with.

Moreover you should definitely try out standard approach - reinstall the dependencies: rm -fr node_modules yarn.lock && yarn install and then try to build.

Thank you Doing this worked for me

rm -fr node_modules package-lock.json && npm install

Hey! 👋 This is the version we use inside the library and test with. Moreover you should definitely try out standard approach - reinstall the dependencies: rm -fr node_modules yarn.lock && yarn install and then try to build.

Thank you Doing this worked for me

rm -fr node_modules package-lock.json && npm install

it work!

Hi, @Gabotron-ES, would you mind checking out

kotlinVersion = "1.6.21"

(same version for Kotlin Gradle Plugin)

This is the version we use inside the library and test with.

Moreover you should definitely try out standard approach - reinstall the dependencies: rm -fr node_modules yarn.lock && yarn install and then try to build.

I’ve tried to build react-native-screens with react-native@0.68.5 and it seems to be working fine. This indicates that this is likely some misconfiguration on your side.

To be able to help you in more concrete wat I would need a repository with a reproduction.