Sign in
Log inSign up

having a trouble to run first flutter app

aidin mansouri's photo
aidin mansouri
·May 4, 2020

Hi Every one ,when I'm trying to run my first app with flutter in android studio or in command line with flutter run it gives this error

Exception in thread "main" java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
    at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2055)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
    at org.gradle.wrapper.Download.download(Download.java:44)
    at org.gradle.wrapper.Install$1.call(Install.java:61)
    at org.gradle.wrapper.Install$1.call(Install.java:48)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    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)
Finished with error: Gradle task assembleDebug failed with exit code 1

the output of flutter doctor -v

[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.17134.1425], locale en-US) • Flutter version 1.12.13+hotfix.9 at C:\src\flutter • Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700 • Engine revision af51afceb8 • Dart version 2.7.2

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\win10\AppData\Local\Android\android-sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • ANDROID_HOME = C:\Users\win10\AppData\Local\Android\android-sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted.

[√] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 45.1.1 • Dart plugin version 192.7761Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code, 64-bit edition (version 1.34.0) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.2.0

[√] Connected device (1 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!

==============================

PS: and i had another issue a while back so i changed flutter.gradle file like this

buildscript {
repositories {
    google()
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
}