React-Native error Task :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
基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01