'Can not start flutter emulator in VSCode
I am trying to start android emulator in vs code but it gives me the following errors:
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
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)
Gradle task assembleDebug failed with exit code 1
When I run flutter doctor, there is no any issues
I try to wipe data from android studio AVD manager and now it gives me an error saying:
Failed to launch flutter emulator: Error: Emulator didn't connect within 60 seconds
I follow the steps from this link and now it stuck at Running Gradle task 'assembleDebug'... when I try to run debug in vs code.
Solution 1:[1]
One of the workaround for the error
Emulator didn't connect within 60 seconds
Is to force kill the process:
- Go to cmd and type adb kill-server
- Go to task manager and find adb in processes. If you find one, right click on it and click on end process tree.
Then you can go ahead of wiping the data in your emulator as suggested in this SO post.
In your case that it is stuck at
Running Gradle task 'assembleDebug'...
Try to follow these steps:
- Open your Flutter Project directory.
- Change directory to android directory in your Flutter project directory
cd android- clean gradle
./gradlew clean- Build gradle
./gradlew buildor you can combine both commands with just./gradlew clean build- Now run your flutter project. If you use vscode, press
F5. First time gradle running assembleDebug will take time.PS: Delete gradle in case of all that steps don't work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MαπμQμαπkγVπ.0 |
