Flutter 環(huán)境搭建問(wèn)題記錄

問(wèn)題:運(yùn)行 flutter doctor 命令卡住問(wèn)題解決
解決:設(shè)置國(guó)內(nèi)鏡像

mac
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
windows
![捕獲.PNG](https://upload-images.jianshu.io/upload_images/9196938-f7502583872c2e8e.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

問(wèn)題:Flutter 編譯卡住 Running Gradle task 'assembleDebug'
解決: 修改<your path>\flutter\packages\flutter_tools\gradle\flutter.gradle 文件

buildscript {
    repositories {
       // google() 注釋掉 換成國(guó)內(nèi)鏡像
       // jcenter() 注釋掉 換成國(guó)內(nèi)鏡像
       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.5.0'
    }
}

android 工程目錄修改build.gradle文件,替換國(guó)內(nèi)鏡像地址

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        maven{ url 'https://maven.aliyun.com/repository/google'}
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
        maven{ url 'https://maven.aliyun.com/repository/public'}
        maven{ url 'https://maven.aliyun.com/repository/jcenter'}
//        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        maven{ url 'https://maven.aliyun.com/repository/google'}
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
        maven{ url 'https://maven.aliyun.com/repository/public'}
        maven{ url 'https://maven.aliyun.com/repository/jcenter'}
//        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容