New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter application won't run #147459
Comments
Hey, Why are you including
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath 'dev.flutter:flutter-plugin' // Update the version to the latest if needed
}
} This is not how you do it. It's expected that it won't work. There's also #135392 where you can find nice overview of what Gradle buildfiles should look like. |
look at the error i get now please help me
PS C:\Users\AJTECH\Documents\anotherapp> flutter run
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Exception in thread "main" java.net.SocketException: A connection attempt
failed because the connected party did not properly respond after a period
of time,
or established connection failed because connected host has failed to
respond
at
java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:330)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:355)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:808)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
at
java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
at
java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
at
java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
at
java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
at
java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510)
at
java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425)
at
java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
at
java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
at
java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:589)
at
java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:187)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2922)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2831)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1927)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
at
java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
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)
Running Gradle task 'assembleDebug'... 174.6s
…On Sun, Apr 28, 2024 at 11:48 AM Bartek Pacia ***@***.***> wrote:
Hey,
Why are you including classpath 'dev.flutter:flutter-plugin' in
android/build.gradle right after flutter create? Does the app not build
after flutter create?
Modify the buildscript block to include the Flutter plugin dependency
without specifying a version, like so:
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath 'dev.flutter:flutter-plugin' // Update the version to the latest if needed
}
}
This is not how you do it. It's expected that it won't work.
There's also #135392 <#135392>
where you can find nice overview of what Gradle buildfiles should look like.
—
Reply to this email directly, view it on GitHub
<#147459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFCYB4TB476QLQYYH7EEOUDY7THZPAVCNFSM6AAAAABG37FBI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGQZTCNRQGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Was the original error solved? If you encounter new problems, please create a new issue with reproducible steps. |
No, not yet.
…On Mon, Apr 29, 2024, 10:52 AM Bartek Pacia ***@***.***> wrote:
Was the original error solved?
If you encounter new problems, please create a new issue with *reproducible
steps*.
—
Reply to this email directly, view it on GitHub
<#147459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFCYB4VZ5UE4E4FUITFQDZ3Y7YJ6DAVCNFSM6AAAAABG37FBI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBSGMYTAOJTGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Does the original error appear now? Or is it only the second one? Please explain what problem you're facing more details, otherwise this issue might be closed as "non reproducible". |
Steps to reproduce
To reproduce the issue where Gradle fails to resolve the Flutter plugin dependency in a Flutter project, follow these steps:
Ensure you have Flutter and Android Studio installed and properly configured on your system.
Create a new Flutter project using the following command in your terminal or command prompt:
Open the
settings.gradle
file in theandroid
directory of your Flutter project.Modify the
buildscript
block to include the Flutter plugin dependency without specifying a version, like so:Save the changes to
settings.gradle
.Attempt to run the Flutter project using the following command:
The error message will indicate that Gradle failed to find any versions of the
dev.flutter:flutter-plugin
artifact, leading to a failed build process.Actual results
C:\Users\AJTECH\Documents\demoapp>flutter run
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
Could not resolve all artifacts for configuration 'classpath'.
BUILD FAILED in 16s
Running Gradle task 'assembleDebug'... 18.7s
Error: Gradle task assembleDebug failed with exit code 1
Logs
Microsoft Windows [Version 10.0.19045.4291]
(c) Microsoft Corporation. All rights reserved.
C:\Users\AJTECH>flutter create demoapp
Creating project demoapp...
Resolving dependencies in demoapp... (11.1s)
Got dependencies in demoapp.
Wrote 129 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ cd demoapp
$ flutter run
Your application code is in demoapp\lib\main.dart.
C:\Users\AJTECH>cd demoapp
C:\Users\AJTECH\demoapp>flutter run --verbose
[+1040 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +36 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[ +76 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +12 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +12 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +9 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +16 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +12 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +597 ms] executing: C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[ +545 ms] List of devices attached
emulator-5554 offline transport_id:1
emulator-5556 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86
device:generic_x86 transport_id:2
[ +130 ms] C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5556 shell getprop
[ +897 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +74 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +26 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +8 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +16 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +13 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[+1448 ms] Skipping pub get: version match.
[+1214 ms] Generating
C:\Users\AJTECH\demoapp\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +431 ms] ro.hardware = ranchu
[ +863 ms] No packages with native assets. Skipping native assets compilation.
[ +64 ms] Initializing file store
[ +79 ms] Skipping target: gen_localizations
[ +76 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
updated contents: C:\Users\AJTECH\demoapp.dart_tool\package_config_subset}
[ +758 ms] gen_dart_plugin_registrant: Complete
[ +20 ms] _composite: Starting due to {}
[ +4 ms] _composite: Complete
[ +20 ms] complete
[ +81 ms] Launching lib\main.dart on Android SDK built for x86 in debug mode...
[ +34 ms] C:\Users\AJTECH\Documents\flutter\bin\cache\dart-sdk\bin\dartaotruntime.exe --disable-dart-dev
C:\Users\AJTECH\Documents\flutter\bin\cache\dart-sdk\bin\snapshots\frontend_server_aot.dart.snapshot --sdk-root
C:\Users\AJTECH\Documents\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true
-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/c4cd48e186460b32d44585ce3c103271ab676355/
--output-dill C:\Users\AJTECH\AppData\Local\Temp\flutter_tools.c2a19511\flutter_tool.298831ec\app.dill --packages
C:\Users\AJTECH\demoapp.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build\2794971a5855e7decd7bb368de5d49d1.cache.dill.track.dill --verbosity=error
--enable-experiment=alternative-invalidation-strategy
[ +139 ms] executing: C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5556 shell -x logcat
-v time -t 1
[+2827 ms] <- compile package:demoapp/main.dart
[ +370 ms] --------- beginning of main
04-27 10:32:49.328 D/hwcomposer( 1230): hw_composer sent 400 syncs in 60s
[ +66 ms] executing: C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe version
[ +302 ms] Android Debug Bridge version 1.0.41
Version 35.0.1-11580240
Installed as C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe
Running on Windows 10.0.19045
[ +37 ms] executing: C:\Users\AJTECH\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
[ +368 ms] Building APK
[ +164 ms] executing: C:\Program Files\Android\Android Studio\jbr\bin\java -version
[ +801 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jbr\bin\java -version
[ +9 ms] openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+0--11185874)
OpenJDK 64-Bit Server VM (build 17.0.9+0--11185874, mixed mode)
[ +68 ms] executing: C:\Program Files\Android\Android Studio\jbr\bin\java --version
[ +820 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jbr\bin\java --version
[ +28 ms] openjdk 17.0.9 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+0--11185874)
OpenJDK 64-Bit Server VM (build 17.0.9+0--11185874, mixed mode)
[ +313 ms] Using gradle from C:\Users\AJTECH\demoapp\android\gradlew.bat.
[ +18 ms] Running Gradle task 'assembleDebug'...
[ +60 ms] executing: [C:\Users\AJTECH\demoapp\android/] C:\Users\AJTECH\demoapp\android\gradlew.bat --full-stacktrace
--info -Pverbose=true -Ptarget-platform=android-x86 -Ptarget=C:\Users\AJTECH\demoapp\lib\main.dart
-Pbase-application-name=android.app.Application
-Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNv
bS9mbHV0dGVyLWNhbnZhc2tpdC9jNGNkNDhlMTg2NDYwYjMyZDQ0NTg1Y2UzYzEwMzI3MWFiNjc2MzU1Lw== -Pdart-obfuscation=false
-Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
Flutter Doctor output
Microsoft Windows [Version 10.0.19045.4291]
(c) Microsoft Corporation. All rights reserved.
C:\Users\AJTECH>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
Error 1 retrieving device properties for Android SDK built for x86:
error: closed
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.10.0 Preview 3.0)
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.88.1)
[√] Connected device (4 available)
! Device emulator-5556 is offline.
[√] Network resources
• No issues found!
C:\Users\AJTECH>flutter doctor -v
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
• Flutter version 3.19.6 on channel stable at C:\Users\AJTECH\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e6646 (10 days ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\AJTECH\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Users\AJTECH\AppData\Local\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.10.0 Preview 3.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Preview
• Visual Studio Enterprise 2022 version 17.10.34804.81
• The current Visual Studio installation is a pre-release version. It may not be supported by Flutter yet.
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
[√] VS Code (version 1.88.1)
• VS Code at C:\Users\AJTECH\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.86.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4291]
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.78
• Edge (web) • edge • web-javascript • Microsoft Edge 123.0.2420.97
[√] Network resources
• All expected network resources are available.
• No issues found!
C:\Users\AJTECH>
The text was updated successfully, but these errors were encountered: