React原生应用在android上安装失败



我刚刚创建了一个新的react-native项目,当我试图在android上运行它或运行gradlew clean时,我得到了以下错误:

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
FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory.
> Could not create service of type KotlinDslWorkspaceProvider using GradleUserHomeServices.createKotlinDslWorkspaceProvider().
> Unexpected lock protocol found in lock file. Expected 3, found 0.

在尝试启动一个旧的react-native应用程序后,我注意到我现在无法安装任何应用程序,所以可能是我的项目之外的错误。

有人经历过类似的事情吗?

我用Java 11代替Java 8修复了这个问题。

我删除了gradle cash,然后得到一个新的错误告诉我使用java 11。

最新更新