I tried to run my first flutter project but i keep getting this error.
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 download gradle.jar (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.jar'.
Premature end of Content-Length delimited message body (expected: 4170314; received: 2359280
Could not download bundletool.jar (com.android.tools.build:bundletool:0.9.0)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.9.0/bundletool-0.9.0.jar'.
Premature end of Content-Length delimited message body (expected: 5248142; received: 4456416
Could not download protos.jar (com.android.tools.analytics-library:protos:26.5.0)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.5.0/protos-26.5.0.jar'.
Premature end of Content-Length delimited message body (expected: 3432065; received: 2359280
Could not download kotlin-stdlib-common.jar (org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50)
Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.50/kotlin-stdlib-common-1.3.50.jar'.
Read timed out
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 20m 5s
Exception: Gradle task assembleDebug failed with exit code 1
[Screenshot1
I used free vpn proxy like hotspot shield.. For some reason i guess in your area those links are blocked unfortunately and unexpectedly.. like in my area.. so please use any free vpn and update your packages again..
If that problem still occurs then I think you are trying to create an android project in a flutter project.
Usually android studio shows a pop up box for that. Which you should not click okay..
if this is not the problem can you please clarify bit more? shuch from where you have get the project and what have you done before it was doing all the updates?
Related
I have created app icons with a website called appicon. It provided icon files for both android(mipmap files) and ios devices(an Assets.xcassets file), which I added to their respective locations being (C:\Users\user\StudioProjects\i_am_rich(name of app)\android\app\src\main\res) for android and (C:\Users\user\StudioProjects\i_am_rich\ios\Runner) for ios.
When I run the program the following error is displayed:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\user\StudioProjects\i_am_rich\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher (aka com.example.i_am_rich:mipmap/ic_launcher) 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 36s
Exception: Gradle task assembleDebug failed with exit code 1
I am learning Android Studio as the IDE with flutter, as a beginner, so I don't understand the problem nor what I have to do to fix it.
Help and, possibly, an explanation would be greatly appreciated :)
The website you mentioned does generate correct names and correct order of directories it seems. so most probably this is an issue with where you have put your files or the name of the files.
The 5 directories of icons must be copied to android\app\src\main\res folder.
and make sure in each directory you have a file called ic_launcher
if all is correct, please run flutter clean command and try again.
also by anychance the webisite generating incorrect files, try using this web site AndroidAssetStudio
I recently changed my flutter project folder into a new one which will be used for production but after recopying everything back into the the new one i keep gettting this error
Launching lib\main.dart on Samsung Galaxy S10 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 dependencies for configuration ':classpath'.
> Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().
> Unexpected lock protocol found in lock file. Expected 3, found 0.
* 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 2m 24s
Exception: Gradle task assembleDebug failed with exit code 1
I have followed other way to to resolve eg like what someone said here in stack-overflow. i have also deleted the gradle from cache restarted my app still showing this error
Some of the build.gradle files can be found here github. Please how do i fix this, Thanks. Also if you need more explanation or code tell me
A useful answer from this post Error:Unexpected lock protocol found in lock file. Expected 3, found 0
cd path/to/.gradle/
find . -name "*.lock" -delete
So I am new to app development I installed flutter as per the instruction on https://flutter.dev/docs/get-started/install
Installed Flutter
Installed Android Studio
When I am running the app this error comes up.
Here error msg I am getting
Here's the error msg
[Fatal Error] aapt2-3.2.1-4818971.pom:2:1: Content is not allowed in prolog.
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
Could not resolve com.android.tools.build:aapt2:3.2.1-4818971.
Required by:
project :app
Could not resolve com.android.tools.build:aapt2:3.2.1-4818971.
Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
Content is not allowed in prolog.
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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1
Try this,
1).Close android studio.
2).Delete all the contents of below directories.
C:\Users\USER_NAME\.android\build-cache
C:\Users\USER_NAME\.android\cache
C:\Users\USER_NAME\.gradle\caches
3).Start Android Studio.
Solved !!
So there was some problem in my Android SDK Path Variable which I fixed and also cleared my Gradle cache and it worked like charm.
I am trying to build an android app with flutter and vscode but I am continuously getting an error.
Launching lib\main.dart on Micromax Q427 in debug mode...
Error running Gradle: Exit code 1 from:
E:\Flutter\mytestapp\android\gradlew.bat app:properties: Starting a
Gradle Daemon, 2 busy Daemons could not be reused, use --status for
details Download
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar
Download
https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
Download
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
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
download builder.jar (com.android.tools.build:builder:3.0.1)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar'.
Premature end of Content-Length delimited message body (expected: 26945712; received: 8650688 Could not download intellij-core.jar
(com.android.tools.external.com-intellij:intellij-core:26.0.1) Could
not get resource
'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar'.
Premature end of Content-Length delimited message body (expected: 8234273; received: 6553552
Try: Run with --stacktrace option to get the stack trace. Run with
--info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 14m 39s Please review your Gradle project setup in the
android/ folder. Exited (sigterm)
I have tried many solutions but nothing worked also flutter doctor shows no issue and I am not able to understand why I am getting this error while building my app.
I have also asked this query in github but got no reply so far here is the link: https://github.com/flutter/flutter/issues/19614
I am starting with hello world example to learn nativescript.
I am compiling and building code behind corporate explicit proxy. I am able to create project and add android platform in my project. but when i try to build the project I face below error.
D:\CurrentProjects\Android\NativeScript\simple>tns run android
Executing before-prepare hook from D:\CurrentProjects\Android\NativeScript\simpl
e\hooks\before-prepare\nativescript-dev-android-snapshot.js
Preparing project...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'simple'.
Could not resolve all dependencies for configuration ':classpath'.
Could not download gradle-core.jar (com.android.tools.build:gradle-core:2.1
.2)
Could not get resource 'https://jcenter.bintray.com/com/android/tools/bu
ild/gradle-core/2.1.2/gradle-core-2.1.2.jar'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gr
adle-core/2.1.2/gradle-core-2.1.2.jar'.
This is usually a temporary error during hostname resolution and m
eans that the local server did not receive a response from an authoritative serv
er (jcenter.bintray.com)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 21.159 secs
Processing node_modules failed. Error: Command D:\CurrentProjects\Android\Native
Script\simple\platforms\android\gradlew.bat failed with exit code 1
Gradle is accessible from browser. But "tns build android" or "tns run android" couldn't download and give above proxy error. This seems gradle error but don't have answer in gradle as well.
UPDATE: when network guy removed proxy authentication check at his end, gradle compiled. I guess issue is gradle is not taking up proxy settings as mentioned in other answers on stackoverflow.