npx expo run:android不工作没有什么方法我没试过.我该怎么办?谢谢.

PS C:\Users\abc\Desktop\my-app> npx expo run:android
› Building app...
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\abc\Desktop\my-app\node_modules\expo-modules-autolinking\scripts\android\autolinking_implementation.gradle' line: 356

* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-modules-core'.
   > Failed to notify project evaluation listener.
      > No enum constant org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.JvmTargetValidationMode.WARN¦NG
      > KotlinJvmAndroidCompilation with name 'debugAndroidTest' not found.

* 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

BU¦LD FAILED in 13s
5 actionable tasks: 5 up-to-date
Error: C:\Users\abc\Desktop\my-app\android\gradlew.bat exited with non-zero code: 1
Error: C:\Users\abc\Desktop\my-app\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\abc\Desktop\my-app\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at cp.emit (C:\Users\abc\Desktop\my-app\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)
    ...
    at Object.spawnAsync [as default] (C:\Users\abc\Desktop\my-app\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
    at spawnGradleAsync (C:\Users\abc\Desktop\my-app\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
    at Object.assembleAsync (C:\Users\abc\Desktop\my-app\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
    at runAndroidAsync (C:\Users\abc\Desktop\my-app\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

推荐答案

我用expo-build-properties将Kotlin版本升级到了1.9.0,它起作用了.

expo 文件:https://docs.expo.dev/versions/latest/sdk/build-properties/

App.json

{
  "expo": {

    ...

    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "kotlinVersion": "1.9.0"
          }
        }
      ]
    ]
  }
}

React-native相关问答推荐

使用NextJS映射从数组中提取用户角色

收到错误Constants.platform.ios.model已被弃用,以支持 expo-device

无法解析 com.google.gms:google-services:4.3.15

什么是 expoClientId?

react-native 签名 [AppName]Tests 需要开发团队 ios

为什么会出现此错误:Invariant Violation: Cannot update during an existing state transition

在Windows中连接到远程调试器时react-native 超时

我如何知道我的代码是否作为 React Native 运行

使用 Hooks 在功能组件中react-navigation 标题

fetch API 总是返回 {"_U": 0, "_V": 0, "_W": null, "_X": null}

在使用 redux-persist 重新水化存储之前加载初始状态的默认值

如何从 React Native 应用程序打开 Google Play store ?

获取没有地理位置 API React-native 的国家/城市?

在 React Native Navigator 中的组件之间传递值

如何在自定义组件上使用 onPress?

react-native 元素/目录 struct 设置

ReactNative Flatlist - RenderItem not working

React Native 中的 CSS 三角形

将 Picker 绑定到 React Native 中的 Picker.Item 列表

无法在react-native中分配给# 的只读属性props