Flutter项目运行报错
一、新建项目运行报错: Exception in thread “main” java.net.ConnectException: Connection timed out: connect
新建项目时选择了kotlin,运行报错,再次新建项目取消支持kotlin,运行正常。
分析:kotlin版本不对。原kotlin版本为1.3.31,gradle版本为1.3.50。打开build.gradle可以查看到提示:Kotlin version that is used for building with Gradle (1.3.50) differs from the one bundled into the IDE plugin (1.3.31) less… (Ctrl+F1)
Inspection info: This inspection reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behaviour.
版本不对会冲突出问题。
解决办法一:不用kotlin得话,新建时不选kotlin。
解决办法二:使用kotlin的话:settings ——》languages&framworks ---->Kotlin 选择 install,更新kotlin。我更新到了1.3.61,虽然还是又警告,但是已经能运行。