React-Native 错误任务:expo:compileReleaseKotlin FAILED

React-Native error Task :expo:compileReleaseKotlin FAILED(React-Native 错误任务:expo:compileReleaseKotlin FAILED)

本文介绍了React-Native 错误任务:expo:compileReleaseKotlin FAILED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Expo 的 React Native 项目中运行以下内容时遇到错误.我尝试了不同版本的 Expo,并删除并重新创建了 node_modules 和 package-lock.json 文件.

I am getting an error running the following in my React Native project with Expo. I have tried different versions of Expo and have deleted and recreated the node_modules and package-lock.json files.

./gradlew bundleRelease --stacktrace

> Task :expo:compileReleaseKotlin FAILED
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (11, 23): Unresolved reference: createApplicationLifecycleListeners
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (12, 20): Unresolved reference: it
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (18, 23): Unresolved reference: createApplicationLifecycleListeners
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (19, 20): Unresolved reference: it
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ExpoModulesPackage.kt: (10, 21): Unresolved reference: adapters
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ExpoModulesPackage.kt: (11, 21): Unresolved reference: core
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ExpoModulesPackage.kt: (16, 31): Unresolved reference: ModuleRegistryAdapter
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt: (22, 19): Unresolved reference: createReactActivityLifecycleListeners
e: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/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: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (23, 19): Unresolved reference: createReactNativeHostHandlers
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (30, 14): Unresolved reference: it
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (57, 14): Unresolved reference: it
e: /Users/anderbard/Development/cloversocial/MyApp/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (63, 14): Unresolved reference: it
e: /Users/anderbard/Development/cloversocial/MyApp/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:compileReleaseKotlin'.

我需要更旧版本的 Expo 吗?有什么建议吗?

Do I need an even older version of Expo? Any suggestions?

推荐答案

只需删除 Android 和 iOS 文件夹并使用 expo 弹出重新创建它们对我有用.在查看 android 文件夹中的更改后,与 42 相比,Expo 44 中有很多非常不同的文件,这可能是它无法构建的原因.

Just deleting the Android and iOS folders and re-creating them with expo eject worked for me. Upon review of what changed in the android folder, there are a lot of files that are very different in Expo 44, compared to 42, which is probably why it won't build.

这篇关于React-Native 错误任务:expo:compileReleaseKotlin FAILED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:React-Native 错误任务:expo:compileReleaseKotlin FAILED

基础教程推荐