Execution failed for task:React-Native-gradle-plugin: Compile Kotlin

Please I got this error Execution failed for ‘task:React-Native-gradle-plugin: Compile Kotlin’
Using the latest cli version
Gradle 6.83(downgraded from Gradle 7.5.1
Expo version 44.0.6

Hi @akintunji

Please provide the error message from the “gradlew” logs

Thanks @ woode


Look further up in the logs for “fail” and copy and paste the error message from around there

Non actually this all.@woodin

There must be something. Even the error you posted says “See log for more details”. Try searching in your browser for “fail” in the “Run gradlew” log. Find the first instance.

Also, please don’t take a photograph of your screen. A screenshot is bad enough. It would be better to copy and paste the text. Maybe you have been showing the right part of the logs, but I can’t see because it is cropped.

But just in case an Expo team member can have a look, please also post the URL of the failed build. I won’t be able to see it, but Expo team members will be able to if they notice this thread.

Thanks ,Here is the link to the build ;Build Details — 7c25f01e-a870-4ac0-bced-4220f9e13163 — Apaymrent — Expo

The error proper

/home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 33): Unresolved reference: replaceFirstChar
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 52): Unresolved reference: it
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (252, 16): Unresolved reference: lowercase
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (13, 38): Unresolved reference: lowercase
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (15, 57): Unresolved reference: lowercase
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (18, 54): Unresolved reference: lowercase
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (19, 52): Unresolved reference: lowercase
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 27): Type mismatch: inferred type is Unit but CharSequence was expected
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 44): Unresolved reference: replaceFirstChar
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 63): Unresolved reference: it
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ‘:react-native-gradle-plugin:compileKotlin’.
[stderr] > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
[stderr] > Compilation error. See log for more details
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 18s
Error: Gradle build failed with unknown error. See logs for the “Run gradlew” phase for more information.

Thanks. OK, from the errors it’s not clear what is causing the problem, but I suspect there’s an issue with conflicting versions of some of your dependencies.

Could you please run expo-cli doctor to see if it complains about anything? If it does, try expo-cli doctor --fix-dependencies.

Also, please paste your dependencies and devDependencies sections from package.json.

Hi @akintunji, as @wodin suggested, please run expo-cli doctor --fix-dependencies command since your project using a different React Native version (0.69.6) for SDK 44 than the compatible one (0.64.3). You can see the same error in the “Run expo doctor” section under “Logs” for the build.

1 Like

Thanks @ woodin and amanhimself
When I ran Expo cli --fix dependencies I got this new error

Running ‘gradlew :app:assembleRelease’ in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-6.8.3-bin.zip
Welcome to Gradle 6.8.3!
Here are the highlights of this release:

  • Faster Kotlin DSL script compilation
  • Vendor selection for Java toolchains
  • Convenient execution of tasks in composite builds
  • Consistent dependency resolution
    For more details see Gradle 6.8.3 Release Notes
    To honour the JVM settings for this build a single-use Daemon process will be forked. See The Gradle Daemon.
    Daemon will be stopped at the end of the build
    [stderr] FAILURE: Build failed with an exception.
    [stderr] * Where:
    [stderr] Settings file ‘/home/expo/workingdir/build/android/settings.gradle’ line: 3
    [stderr] * What went wrong:
    [stderr] A problem occurred evaluating settings ‘Aproject’.
    [stderr] > Could not read script ‘/home/expo/workingdir/build/node_modules/expo/scripts/autolinking.gradle’ as it does not exist.
    [stderr] * Try:
    [stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    [stderr] * Get more help at https://help.gradle.org
    [stderr] BUILD FAILED in 12s
    Error: Gradle build failed with unknown error. See logs for the “Run gradlew” phase for more information

I can’t access the android/settings.gradle file

Hi @akintunji

OK, so it seems that expo-cli doctor --fix-dependencies did make some changes, but did not completely fix the problem.

Try removing node_modules and your package lock file (either ‘yarn.lock’ or ‘package-lock.json’ depending on whether you use yarn or npm respectively to manage your dependencies.)

Then reinstall your dependencies with either:

npm install



depending on which tool you use.

Then re-run expo-cli doctor --fix-dependencies

That will hopefully fix it. If not:

That’s because you have an invalid Expo SDK version in package.json. Currently, you have set it to 1.0.0. You’ll have to fix that.

I fix it and still got another error,I had to start another project afresh copied the files and install the necessary package,Built was successful but on installation app is crashing.I have five projects with expo that are crashing.
@amanhimself It’s like something is wrong somewhere, You guys should do something.

The first thing to try in a case where the app works in Expo Go or a development build, but the preview or production version crashes is to try to reproduce the problem in Expo Go or the development build by using:

npx expo start --no-dev --minify

If that also crashes, then you will hopefully get some more information about the crash and you can troubleshoot it.

See also:

Can you share the link to the build of the new project that is building successfully but is crashing?

And as @wodin mentioned in the previous post, please try the approach and see the debugging guides to debug what could be causing the issue.

@ amanhimself
Here it is Build Details — 6e35d64e-6c50-4c6c-a122-715f1164176e — JJJJ — Expo
Thanks but the less challenge you encounters in a language/framework the more your interest and recommendation to newbies.

Sorry for the inconvenience!

Reproducing the latest build link you shared on my end doesn’t crash. So I don’t think this is related to something Expo. I think it might be related to the JavaScript code of your app, which might be leading to a crash. Since you are building a production build and not a debug/development build that is crashing in your case, take a look at the how to access the adb log as mentioned in the debugging guide here: Debugging - Expo Documentation as to what is causing the crash.

About the other builds, if you can share more details, I can help with that, but there is no single underlying issue I can point to. I definitely get the point of closing the gap between complexity and ease of the process and is something we are continuously focusing on. However, sometimes if the complexity is caused by a project’s JavaScript code there is little we can suggest other than checking logs.

The problems is if it is building well in development stages, Why the crashes in production??

The problem is that the development environment is not the same as the production environment. This is to make things faster and easier to debug in development, but it unfortunately can result in things working in development, but crashing in production.

If you use npx expo start --minify --no-dev then the development environment will be closer to the production environment, so you can see if it crashes there too. Then it will be a bit easier to see what’s going wrong. If that doesn’t work, try looking at the device logs as Aman suggested, or try some of the other debugging info from my previous message.

1 Like

Thanks@ Woodin It could be included in the docs too.

1 Like