'ERROR Task :expo:compileDebugKotlin FAILED

I created an application using react-native init and was working fine until I tried to start using expo to test it on my telephone.

Trying to start the app with expo (npx expo start), I have:

Developer tools running on http://localhost:19002
Opening developer tools in the browser...
Some dependencies are incompatible with the installed expo package version:
- @react-native-community/slider - expected version: 4.1.7 - actual version installed: 4.1.10
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]
Starting Metro Bundler

Error: Problem validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/
should NOT have additional property 'displayName'.

and the application in expo becomes fully white.

Also, if I try with react-native (npx react-native run-android) I have:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1190 file(s) to forward-jetify. Using 6 workers...

> Configure project :expo

> Task :expo:compileDebugKotlin FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
87 actionable tasks: 3 executed, 84 up-to-date
Error: Autolinking is not set up in `settings.gradle`: expo modules won't be autolinked.
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (11, 18): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (11, 23): Unresolved reference: createApplicationLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (12, 10): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (12, 20): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (18, 18): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (18, 23): Unresolved reference: createApplicationLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (19, 10): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (19, 20): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (10, 21): Unresolved reference: adapters
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (11, 21): Unresolved reference: core
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (16, 31): Unresolved reference: ModuleRegistryAdapter
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (22, 14): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (22, 19): Unresolved reference: createReactActivityLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (53, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (60, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (66, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (73, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (23, 14): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (23, 19): Unresolved reference: createReactNativeHostHandlers
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (30, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (57, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (63, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (85, 31): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Error: Autolinking is not set up in `settings.gradle`: expo modules won't be autolinked.
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (11, 18): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (11, 23): Unresolved reference: createApplicationLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (12, 10): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (12, 20): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (18, 18): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (18, 23): Unresolved reference: createApplicationLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (19, 10): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ApplicationLifecycleDispatcher.kt: (19, 20): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (10, 21): Unresolved reference: adapters
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (11, 21): Unresolved reference: core
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ExpoModulesPackage.kt: (16, 31): Unresolved reference: ModuleRegistryAdapter
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (22, 14): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (22, 19): Unresolved reference: createReactActivityLifecycleListeners
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (53, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (60, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (66, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactActivityDelegateWrapper.kt: (73, 37): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (23, 14): Type mismatch: inferred type is Unit but Iterable<TypeVariable(R)> was expected
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (23, 19): Unresolved reference: createReactNativeHostHandlers
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (30, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (57, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (63, 14): Unresolved reference: it
e: C:\Proyectos\propios\Placit\node_modules\expo\android\src\main\java\expo\modules\ReactNativeHostWrapper.kt: (85, 31): Overload resolution ambiguity:
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s

    at makeError (C:\Proyectos\propios\Placit\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at C:\Proyectos\propios\Placit\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async runOnAllDevices (C:\Proyectos\propios\Placit\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
    at async Command.handleAction (C:\Proyectos\propios\Placit\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)

This is my package.json:

{
  "name": "placit",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.36",
    "@fortawesome/free-solid-svg-icons": "^5.15.4",
    "@fortawesome/react-native-fontawesome": "^0.2.7",
    "@react-native-async-storage/async-storage": "^1.15.9",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/slider": "^4.1.10",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.4",
    "expo": "^43.0.1",
    "react": "17.0.2",
    "react-native": "0.66.0",
    "react-native-elements": "^3.4.2",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.8.0",
    "react-native-svg": "^12.1.1",
    "react-redux": "^7.2.5",
    "redux": "^4.1.1",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/core": "7.15.8",
    "@babel/runtime": "7.15.4",
    "@react-native-community/eslint-config": "2.0.0",
    "babel-jest": "26.6.3",
    "eslint": "7.14.0",
    "jest": "26.6.3",
    "metro-react-native-babel-preset": "0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}


Solution 1:[1]

You can install by yourself, it's work for when I run expo run:android

expo install expo-linear-gradient

Solution 2:[2]

Upgrading to Kotlin v1.5.10 fixed it for me.

Add the following into your /android/build.grade dependencies

dependencies {
  ...
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
  ...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manmanbbg
Solution 2 George