1.修改項(xiàng)目中的android/build.gradle,將google(),mavenCentral()替換為下面的代碼
maven { url 'https://maven.aliyun.com/repository/central/' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
2.找到flutter的安裝路徑,找到packages\flutter_tools\gradle下的flutter.gradle文件,找到buildscript對(duì)象,對(duì)里面的repositories內(nèi)容進(jìn)行修改,換成以下代碼
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/central/' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
dependencies {
/** When bumping, also update ndkVersion above, as well as the Android Gradle Plugin
* version in ../lib/src/android/gradle_utils.dart.
*/
classpath 'com.android.tools.build:gradle:7.3.0'
}
}
3.依然在flutter.gradle文件中使用“ctrl+F”搜索DEFAULT_MAVEN_HOST,修改為以下代碼
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
(本文的flutter版本為Flutter 3.10.6)
參考:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-614042.html
flutter運(yùn)行一直顯示Running Gradle task 'assembleDebug'.文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-614042.html
到了這里,關(guān)于flutter項(xiàng)目運(yùn)行時(shí)一直卡在Running Gradle task ‘a(chǎn)ssembleDebug‘解決辦法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!