1. 在构建flutter开发环境的时候,android studio 报错:
* Error running Gradle: ProcessException: Process "C:\xxx\Android\flutter_app\android\gradlew.bat" exited abnormally: > Configure project :app Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error. FAILURE: Build failed with an exception. * Where: Build file 'C:\xxx\Android\flutter_app\android\app\build.gradle' line: 25 * What went wrong: A problem occurred evaluating project ':app'. > Could not resolve all artifacts for configuration 'classpath'. > Could not find lint-gradle-api.jar Searched in the following locations: https://jcenter.bintray.com/com.android.tools.lint:lint-gradle-api:26.1.2.jar * 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 0s Command: C:\xxx\Android\flutter_app\android\gradlew.bat app:properties Finished with error: Please review your Gradle project setup in the android/ folder.
2. 一通搜索后提示需要在Project的build.gradle内添加google(),如下:
buildscript { repositories {// google()// jcenter() maven{ url 'https://maven.aliyun.com/repository/google' } maven{ url 'https://maven.aliyun.com/repository/jcenter' } maven{url 'http://maven.aliyun.com/nexus/content/groups/public'} } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories {// google()// jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } }
4.可是有些小伙伴这种操作后还是不行,那怎么办呢,别急,下面还有一种解决方案,那就是修改Flutter下的flutter.gradle文件
1.直接找到并打开Flutter安装目录:Flutter ▸ packages ▸ flutter_tools ▸ gradle
找到下 flutter.gradle文件,把jcenter注释掉,然后再替换上ali的镜像包,这里直接贴出来好了,方便小伙伴直接复制粘贴
buildscript { repositories {// jcenter() maven{ url 'https://maven.aliyun.com/repository/google' } maven{ url 'https://maven.aliyun.com/repository/jcenter' } maven{url 'http://maven.aliyun.com/nexus/content/groups/public'} //maven { // url 'https://dl.google.com/dl/android/maven2' //} } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } }
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接