hello im try to run my flutter app on my real android phone but give me a lot of errors - flutter

Launching lib\main.dart on STK L21 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. Received status code 403 from server: Forbidden
Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. Received status code 403 from server: Forbidden
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 5s
Exception: Gradle task assembleDebug failed with exit code 1

How to Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error?
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level.
Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level
please follow this link :https://fluttercorner.com/flutter-problems-could-not-resolve-all-artifacts-for-configuration-classpath/

First You run Flutter Doctor

Related

Gradle Version in VSCode running Flutter app

I've install the VSCode, Android Studio, and Flutter in my windows. when I try to launch the android emulator (Pixel 4 API TiramisuPrivacySandbox) and Run the app ( default test app generated in VSCode - click counter) I get an error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not find com.android.tools.build:gradle:7.1.2.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
Required by:
project :
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 31s
Exception: Gradle task assembleDebug failed with exit code 1
** in gradle-wrapper.properties file, the gradle version is 7.4
> distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
** in build.gradle file, the gradle version is 7.1.2
> dependencies {
> classpath 'com.android.tools.build:gradle:7.1.2'
> classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
> }`
** in web or windows devices, it runs without error.
Internet Issue ,Check your Internet Connection
if your internet is ok still having this issue then you need to change the internet connection (can use VPN) and try again hope it will work

flutter app apk is giving clipboard_manager error

I am trying to build an apk of my flutter app, but when I run this command
flutter build apk
I encounter the following error;
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':clipboard_manager:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 10.1s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the
incompatibility.
Building plugin clipboard_manager...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 741ms
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'clipboard_manager'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
The plugin clipboard_manager could not be built due to the issue above.
I am getting the flutter pub outdated --mode=null-safety
Package Name Current Upgradable Resolvable Latest
direct dependencies:
clipboard_manager ✗0.0.4 ✗0.0.4 ✗0.0.4 ✗0.0.4
cupertino_icons ✗0.1.3 ✗0.1.3 ✓1.0.3 ✓1.0.3
dio ✗3.0.10 ✗3.0.10 ✓4.0.0 ✓4.0.0
flutter_circular_chart ✗0.1.0 ✗0.1.0 ✗0.1.0 ✗0.1.0
flutter_secure_storage ✗3.3.5 ✗3.3.5 ✓4.2.0 ✓4.2.0
flutter_svg ✗0.19.3 ✗0.19.3 ✓0.22.0 ✓0.22.0
http ✗0.12.2 ✗0.12.2 ✓0.13.3 ✓0.13.3
image_picker ✗0.6.5+3 ✗0.6.5+3 ✓0.8.0+3 ✓0.8.0+3
logger ✗0.9.4 ✗0.9.4 ✓1.0.0 ✓1.0.0
provider ✗4.3.3 ✗4.3.3 ✓5.0.0 ✓5.0.0
8 dependencies are constrained to versions that are older than a resolvable version.
To update these dependencies, edit pubspec.yaml, or run `flutter pub upgrade --null-safety`.
I have searched for it, and they told to change the flutter.sdk, to home.username/Android/Sdk I did this, but after running the buiuld command I got home/lechat/snap/flutter/common/flutter in flutter.sdk in local.properties.
I do not know what the problem actually is. Kindly halp me with this problem. If you any other information I am ready to share it.
I have also followed this question, related problem
but still getting the same error.
Check this similar question there are multiple answers and all of them seem to get the work done, only one of them uses clipboard_manager though.

root project in flutter

hey this is my first app on flutter i got this problem when I run it and I don't know what to do please help:
Plugin project :firebase_auth_web not found. Please update settings.gradle.
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\nouhaila\AndroidStudioProjects\elearning\android\build.gradle' line: 35
What went wrong:
A problem occurred evaluating root project 'android'.
Could not find method implementation() for arguments [com.android.support:support-annotations:28.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Exception: The plugin cloud_firestore could not be built due to the issue above.
If you only have written a little code it might be simplest to start a new project. Start by compiling the starting counter app. After that works you can add more code with every step.

Could not resolve all artifacts for configuration ':app:debugCompileClasspath'

After the flutter 1.17 update, I tried to run my app, but it shows this error. flutter doctor command works fine. I don't understand what is happening
Launching lib\main.dart on Redmi Note 7 Pro in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not download arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-540786dd51f112885a89792d678296b95e6622e5)
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/arm64_v8a_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/arm64_v8a_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
> Remote host closed connection during handshake
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I met with a similar problem of unavailability of kotlin sdk resources. Couldn't find a quick solution, but the problem was most likely on the server side with resources. Because the next morning, the whole assembly was successful.
Perhaps you should just wait, if before that everything was going fine and suddenly stopped.
After reading the entire branch, I still did not find a solution for my case, but it may be useful to someone.
https://github.com/flutter/flutter/issues/23553
I had a similar issue and it was resolved when I changed the following settings in my build.gradle file:
ext.kotlin_version = '1.3.61' //from 1.3.50
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3' //from 3.5.0
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

Getting "Error running Gradle" in step "resolving dependancies" when I try to execute a flutter project

I suspect the proxy setting is not set correctly, or I might be wrong, please help me out here. I'm working under a corporate network and using a VPN.
Error details below:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\flutter_workspace\flutter_app\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
Finished with error: Please review your Gradle project setup in the android/ folder.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.2.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> Connect to dl.google.com:443 [dl.google.com/172.217.9.14] failed: Connection refused: connect
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
Command: D:\flutter_workspace\flutter_app\android\gradlew.bat app:properties
Finally finally figured out what I was missing, I had to set the Proxy in gradle.properties file as directed in developers.android.com. For some reason, setting up the proxy in Android Studio alone didn't work.
Updated gradle.properties file:
org.gradle.jvmargs=-Xmx1536M
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=80
PS: Thanks #Taio for your efforts. I appreciate them
Check your internet connection and make sure it is stable. Gradle is trying to connect to the internet to get resources and is unable to.
In this case I would suggest turning off the vpn and waiting for the build process to go on with a normal internet connection then after build you can continue using the vpn