【发布时间】:2022-01-04 00:07:50
【问题描述】:
我在使用 Expo 的 React Native 项目中运行以下内容时遇到错误。我尝试了不同版本的 Expo,并删除并重新创建了 node_modules 和 package-lock.json 文件。
./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 吗?有什么建议吗?
【问题讨论】:
-
尝试降级 expo 版本并检查。
-
这与删除 android 和 ios 并运行 expo prebuild 相结合
标签: android react-native gradle expo