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..
Related
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.
Flutter Version: 4.1.3
Android Studio: 4.2.1
Gradle version: 3.5.0
There is an issue compiling the flutter app on android device. The app is working fine on any of the iOS device.
FAILURE: Build failed with an exception.
Launching lib/main.dart on sdk gphone x86 arm 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:3.5.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
* 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
Exception: Gradle task assembleDebug failed with exit code 1
Already answered here Android Gradle Issue - Flutter / Dart
Oftenly it is just corrupted Build Gradle. You need to reinstall or replace it with ver that you already have
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.
I'm using Android studio 3.6.1 on windows 10
(I'm new to flutter and this is my first try)
you can see my "flutter doctor" result here (all check):
flutter doctor command result
Unfortunately when I want to run my program this error Occurs:
android studio error
text:
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:3.5.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 127.0.0.1:2347 [/127.0.0.1] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 127.0.0.1:2347 [/127.0.0.1] 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 20s
Finished with error: Gradle task assembleDebug failed with exit code 1
I try all articles in Stack Overflow, YouTube and medium but I'm still stuck :(
Faced same problem, I resolved by;
Delete all files in .gradle folder and reopen Android studio to re-download and update to the latest files.
PATH: C:\Users\<YOUR-USER-NAME>\.gradle
This Worked for me. I hope it helps, then re-run flutter doctor command
After 1 pm today (19/03/2020) I can't compile my Flutter application anymore. Yesterday I followed all the steps in the documentation (https://documentation.onesignal.com/docs/flutter-sdk-setup) and it had worked perfectly. My version of the fluter is as follows and the onesignal:
Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [versão 10.0.18363.720], locale pt-BR)
onesignal_flutter: ^2.3.4
Shows the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find any matches for com.onesignal:OneSignal:[3.11.2,3.99.99] as no versions of com.onesignal:OneSignal are available.
Required by:
project :app
> Could not find any matches for com.onesignal:OneSignal:[3.11.2,3.99.99] as no versions of com.onesignal:OneSignal are available.
Required by:
project :app > project :onesignal_flutter
* 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 20s
Updating onesignal in app/build.gradle seems to fix it
dependencies {
// (OLD) implementation 'com.onesignal:OneSignal:3.11.4, 3.99.99'
implementation 'com.onesignal:OneSignal:3.12.7'
}