VScode+Flutter 開發繼續踩坑

運行慢解決方法1:修改build.gradle,註釋掉jcenter(),google()。使用阿里的鏡像。緣由是jcenter 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' }
    }
}
 
 
第二步:找到fluttersdk目錄 進入以下目錄
 
Macintosh HD⁩ ▸ ⁨用戶⁩ ▸ ⁨rabbit⁩ ▸ ⁨資源庫⁩ ▸ ⁨Flutter⁩ ▸ ⁨packages⁩ ▸ ⁨flutter_tools⁩ ▸ ⁨gradle⁩
找到下 flutter.gradle文件 找如以下內容替換成和我同樣的 把jcenter註釋掉。
 
​buildscript {
    repositories {
        //jcenter()
        //maven {
        //    url 'https://dl.google.com/dl/android/maven2'
        //}
        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'
    }
}
至此重新運行,解決掉問題。
Initializing gradle...                                          |
Oops; flutter has exited unexpectedly: "Exit code 1 from: xx\flutter-project\android\gradlew.bat --v:
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive acccess to file: C:\Users\...\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1-lall.zip
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
        at org.gradle.wrapper.Install.createDist(Install.java:48)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)".
Sending crash report to Google.
Failed to send crash report due to a network error: SocketException: OS Error: 信號燈超時時間已到
, errno = 121, address = clients2.google.com, port = 61269
Crash report written to  xx\flutter-project\flutter_01.log;
please let us know at https://github.com/flutter/flutter/issues.

上面問題解決:java

  • 手動下載 gradle 並解壓。
  • 找到項目/android/gradlew.bat打開。
  • 找到set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar替換爲set CLASSPATH=<path_to_downloaded_gardle>\gradle-4.6\lib\gradle-launcher-4.6.jar
  • 找到"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%替換爲"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %CMD_LINE_ARGS%
  • 從新執行flutter run
插入個鄭州網站建設連接 http://www.cnwtn.com/robots.txt
相關文章
相關標籤/搜索