I can run an app with a native emulator in Android Studio. However, when I try to run it on a physical device via USB from Android Studio, I encounter an issue.
Launching lib\main.dart on Redmi Note 7 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.
Required by:
project :app
> Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.
> Could not get resource 'https://dl.google.com/dl/android/maven2/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'. Received status code 407 from server: Proxy Authentication Required
> Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.
> Could not get resource 'https://repo.maven.apache.org/maven2/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'. Received status code 407 from server: Proxy Authentication Required
> Could not resolve io.flutter:arm64_v8a_debug:1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-c4cd48e186460b32d44585ce3c103271ab676355/arm64_v8a_debug-1.0.0-c4cd48e186460b32d44585ce3c103271ab676355.pom'. Received status code 407 from server: Proxy Authentication Required
I use a proxy with my IDE, but I haven't modified the gradle.properties file, so I don't believe that's the cause of the problem.
BTW, building works good with project without flutter...
I created a completely new project with Flutter and encountered the same issue. I attempted to use my proxy settings with Gradle by modifying the gradle.properties file for HTTP and HTTPS, but nothing changed. I also tried disabling the proxy in my IDE, but that had no effect either.
I tried opening those links manually in my browser, but I received a 404 error from the first and second links, and a file from the third link. Therefore, it seems unlikely that there are any issues with my internet connection, provider, router settings or pc settings.
Solved by completely reinstalling Android Studio
Update: just delete .gradle in Users folder is enough