Flutter 打包报错,jar包无法下载
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':flutter_plugin_android_lifecycle:debugUnitTestRuntimeClasspath'.
> Could not download mockito-core.jar (org.mockito:mockito-core:1.10.19)
> Could not get resource 'https://jcenter.bintray.com/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar'.
> Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/e8546f5bef4e061d8dd73895b4e8f40e3fe6effe?response-content-disposition=attachment%3Bfilename%3D%22mockito-core-1.10.19.jar%22&Polic
y=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvZTg1NDZmNWJlZjRlMDYxZDhkZDczODk1YjRlOGY0MGUzZmU2ZWZmZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1l
bnQlM0JmaWxlbmFtZSUzRCUyMm1vY2tpdG8tY29yZS0xLjEwLjE5LmphciUyMiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTU5MzY3Nzg1Mn0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiIwLjAuMC4wLzAifX
19XX0_&Signature=hJVHYxC6IyHh60mrwXxA1fdFAdA5d-TMcVTSthR2dxFK-NPWYXETVJ7Jmjz2~UOPSWgUQoe7UuNqio5PWESJVd5dAmqm5ZVQe9OQMUmUUhkkKruJsJXYclFpqbWovVkp45hXiaPfSaya3zmqaDGz9P2oBFxyBHVb1fQhXEwkRes7-rpYA
hslQv5jzYcq52W48ufhMksQRfNC7t6gwUzZ~LAcBq3I60LZbHDiDpcCv4GPfK3P7Vs7QvxKsgIUshqUwFj7SUg2IKUGMuh7LPM7NxhCZqBwyDmK2fNqTRmn-egubyAjBp-UG9S8sXXkjotQIEks1C1g5YFxjvb3hBceJw__&Key-Pair-Id=APKAIFKFWOMXM2
UMTSFA'.
> Connection reset
* 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.
解决方法
找到 flutter sdk 的安装路径的 gradle 文件
flutter\packages\flutter_tools\gradle\flutter.gradle
添加如下代码:
buildscript {
repositories {
google()
//新添加的一行代码
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
如果以上还不能解决,尝试一下添加其他的镜像
相关链接:https://blog.csdn.net/qq_24523279/article/details/99412635