Could not resolve all artifacts for configuration ':flutter_local_notifications:classpath' - android

i iam using flutter_local_notifications in my project , i added it to pubspec.yaml and press the pub get.
but after launching the app i faced error below :
* What went wrong:
A problem occurred configuring project ':flutter_local_notifications'.
> Could not resolve all artifacts for configuration ':flutter_local_notifications:classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.jar
> Could not find builder.jar (com.android.tools.build:builder:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.3/builder-3.5.3.jar
> Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.3/crash-26.5.3.jar
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.3/lint-gradle-api-26.5.3.jar
> Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.3/gradle-api-3.5.3.jar
> Could not get unknown property 'android' for project ':flutter_local_notifications' of type org.gradle.api.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 13s
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 flutter_local_notifications...
Running Gradle task 'assembleAarRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'flutter_local_notifications'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.jar
> Could not find builder.jar (com.android.tools.build:builder:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.3/builder-3.5.3.jar
> Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.3/crash-26.5.3.jar
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.3/lint-gradle-api-26.5.3.jar
> Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.3/gradle-api-3.5.3.jar
* 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 3s
Exception: The plugin flutter_local_notifications could not be built due to the issue above.
and here is flutter doctor:
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] Connected device (1 available)
can anyone help me with this please!
i dont know how to solve it and i also need it for my project!
i stuck in it!!!

i finally fixed it by upgrading gradle to the latest version .
just follow the instructions in : https://gradle.org/install/ in part Upgrade with the Gradle Wrapper.

Related

Flutter Could not resolve all files for configuration

I was working on a project and is was working fine left it for 6 weeks and tried to run it yesterday and it gave me this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_plugin_android_lifecycle:extractDebugAnnotations'.
> Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:detachedConfiguration2'.
> Could not find lint-checks-30.1.2.jar (com.android.tools.lint:lint-checks:30.1.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/30.1.2/lint-checks-30.1.2.jar
> Could not find lint-api-30.1.2.jar (com.android.tools.lint:lint-api:30.1.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/30.1.2/lint-api-30.1.2.jar
> Could not find intellij-core-30.1.2.jar (com.android.tools.external.com-intellij:intellij-core:30.1.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/30.1.2/intellij-core-30.1.2.jar
> Could not find kotlin-compiler-30.1.2.jar (com.android.tools.external.com-intellij:kotlin-compiler:30.1.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/30.1.2/kotlin-compiler-30.1.2.jar
> Could not find uast-30.1.2.jar (com.android.tools.external.org-jetbrains:uast:30.1.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/30.1.2/uast-30.1.2.jar
* 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 32s
Exception: Gradle task assembleDebug failed with exit code 1
I tried deleting gradle and .gradle folder, also tried using VPN and changed my DNS also tried flutter clean command but non of the above worked.
note1: tried running the project as a windows app and it worked fine so I think its android build related problem.
note2: tried creating a new project and it worked fine.
note3: I have the latest version of flutter and dart.
The problem was solved
by running flutter clean in the project directory
and delete .gradle folder in C:/Users/DESKTOP-NAME/
and finally, flutter run.

Gradle Issue in Android Studio

Extracted the android package from ionic project, opened it in Android Studio,
Distribution URL : https\://services.gradle.org/distributions/gradle-7.4-all.zip
Inside Project level build.gradle : classpath 'com.android.tools.build:gradle:7.4'
Inside cash.properties : gradle.version=7.4
Getting below error in Android Studio :
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 find com.android.tools.build:gradle:7.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/7.4/gradle-7.4.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 746ms
What might be the Issue ?
From what i've seen here, version 7.4 is not yet available on Google maven repositories.
You could try targeting a lower version (like 7.3.0-alpha05, or 7.1.2 if you need stable release), and don't forget to set the same version to your distributionUrl.

Android Emulator: Could not resolve all artifacts for configuration ':classpath'

When I select a Web chrome device and run flutter application it works, but when I select Android device and run flutter the build fails
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 find apksig-4.1.0.jar (com.android.tools.build:apksig:4.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/4.1.0/apksig-4.1.0.jar
> Could not find annotations-27.1.0.jar (com.android.tools:annotations:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/annotations/27.1.0/annotations-27.1.0.jar
> Could not find databinding-common-4.1.0.jar (androidx.databinding:databinding-common:4.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/4.1.0/databinding-common-4.1.0.jar
> Could not find baseLibrary-4.1.0.jar (com.android.databinding:baseLibrary:4.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/4.1.0/baseLibrary-4.1.0.jar
* 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
Exception: Gradle task assembleDebug failed with exit code 1
Go to ADB manager and Wipe the data of your emulator than run the emulator it works fine

Execution failed for task ':app:mergeDebugResources' in Flutter

I'm new to Flutter and I'm just trying to set it up for the first time. I've been trying to run the Demo App that comes with every new project, but Android Studio returns this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
Required by:
project :app
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> dl.google.com
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> jcenter.bintray.com
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> storage.googleapis.com
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> storage.googleapis.com
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
> storage.googleapis.com
* 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 12m 38s
Exception: Gradle task assembleDebug failed with exit code 1
I've tried installing Gradle manually (offline) and while being connected to the internet. But it doesn't seem to download the .pom files it needs. I've even tried downloading the .pom files manually, in hopes of finding how to put them in the Flutter project manually, but the links (which I copied from the console) take me to "Error 404" pages.
Here's my flutter doctor result:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.49.3)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
I don't have proxy settings enabled. I've tried to find a fix to the issue, but didn't find answers anywhere.
I once had this problem too. And all I did was to connect my computer and device to the internet and the issue was resolved. I hope this works..

Could not find androidx.legacy:legacy-support-v4:27.0.2

I added geolocator dependency and then I get an error of android x incompatibility. can any help me to get out of this?
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.legacy:legacy-support-v4:27.0.2.
Searched in the following locations:
- file:/C:/Users/Rutvik/AppData/Local/Android/sdk/extras/m2repository/androidx/legacy/legacy-support-v4/27.0.2/legacy-support-v4-27.0.2.pom
Required by:
project :app > project :image_picker
* 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 7s
****************************************************
Migrating all the dependancies to andriodx packages will resolve this issue. https://developer.android.com/jetpack/androidx/migrate
Here your geo-locator latest uses androidx packages where image_picker dependency uses android package. You need to update image_picker library to latest https://pub.dev/packages/image_picker#-changelog-tab-
or
Quick fix: Downgrade geo-locator to 2.1.1 to resolve this issue. This is not a best approach.
Upgrading all the dependancies to androidx compatable is best approach you can try.

Categories

Resources