前提
最后这些都是建议在安装了 Flutter 的包,还有 android sdk 包的环境下
gradel 7.3.0的错误
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on BAL AL80 in debug mode...
* What went wrong:
Plugin [id: 'com.android.application', version: '7.3.0', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:7.3.0')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin Repository
解决方法
- 退出当前项目
//但其实核心是有这个,但我找不到了
3.解决后就新建的项目就没有这个问题了
错误2
这个错误是我在添加了 video_player 的flutter 插件后出现的,当时我人也是无语死了,加个插件就错误
What went wrong:
A problem occurred configuring project ':video_player_android'.
> Could not resolve all files for configuration ':video_player_android:classpath'.
> Could not resolve com.android.tools.build:gradle:7.2.1.
Required by:
project :video_player_android
> Could not resolve com.android.tools.build:gradle:7.2.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.2.1/gradle-7.2.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.2.1/gradle-7.2.1.pom'.
> Connect to dl.google.com:443 [dl.google.com/127.0.1.3] failed: Connection refused: no further information
> Could not resolve com.android.tools.build:gradle:7.2.1.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.2.1/gradle-7.2.1.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.2.1/gradle-7.2.1.pom'.
> Connect to repo.maven.apache.org:443 [repo.maven.apache.org/127.0.1.4] failed: Connection refused: no further information
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':video_player_android' of type org.gradle.api.Project.
> Could not get unknown property 'android' for project ':video_player_android' of type org.gradle.api.Project.
* 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
BUILD FAILED in 13s
Retrying Gradle Build: #1, wait time: 100ms
[!] Gradle threw an error while downloading artifacts from the network.
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception
//下载的 Java JDK环境配置,选择下载.zip包,不推荐.exe,我下了还是报错,后面改.zip就不会了,坑
JAVA JDK安装地址
教程自行去找跟配置