Flutter, Gradle not working except on https - gradle

guess your day is going on well!
Just Formatted my system from windows 8 to windows 10 and i want to quickly dive into flutter, so i start using it, i then download android studio.
I got Git downloaded, Flutter downloaded (and i add the path of the flutter sdk to the user path), I downloaded Android studio and then install flutter and dart plugin.
Everything is working fine, run flutter --version, flutter doctor and it work well.
The Challenge
Once i click on the run or debug button in android studio, i do get these 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 resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
Required by:
project :app
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> dl.google.com
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> jcenter.bintray.com
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
Required by:
project :app
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://dl.google.com/dl/android/maven2/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> dl.google.com
> Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> jcenter.bintray.com
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
Required by:
project :app
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> download.flutter.io
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://dl.google.com/dl/android/maven2/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> dl.google.com
> Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
> Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> Could not GET 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
> jcenter.bintray.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 1m 33s
Finished with error: Gradle task assembleDebug failed with exit code 1
For hours, i tried different approach, i still get the above errors, so i decided to browse the following domain which are present in the error
1) gradle.org
2) flutter.io
behold it was not working, i got This page isn’t working {domain name} didn’t send any data.
But when i add the https:// to the above domain name, it work right in the browser
My Question Now is
How do i add https:// to gradle properties or plugin in android

I was also getting this same issue after upgrading to flutter 1.17
maven {
url 'http://download.flutter.io'
}
Adding this to android->build.gradle->allprojects->repositories solved the issue.
The main cause of this issue seems to be my country has blocked some google APIs. I have totally no clue why would they do this.

In my situation
flutter pub cache repair
helps me

I was also facing this issue for couple of hours. After adding maven to build.gradle it was also showing error. at the end solved by executing following steps -
- add to build.gradle under repositories in both buildscript and allprojects section
maven {
url 'http://download.flutter.io'
}
- and also run on command line 'flutter pub cache repair'

Add below to buildscript and allprojects.
maven {
url 'http://download.flutter.io'
allowInsecureProtocol = true
}
Then run 'flutter pub cache repair'

Yes Yes Yes and Yes!
After the long hours spent trying to make things work on android studio with flutter, these below were the things i did and honestly i don't even know which one made it work.
I got some answer from github
https://github.com/flutter/flutter/issues/48494 and i downloaded
all the android sdk version (ALL) and i restart my system and try it
again voila, Flutter Program ran on my emulator.

This issue is mainly due to some errors in your network or firewall or the proxy you have enabled i your system. Try connecting to the Mobile internet Via USB Tethering and run the flutter Application.
This work perfectly and uninstalling & re-installing the android studio or flutter SDK doesn't solve it.

Related

Build failed with an exception Could not resolve io.github.g00fy2:versioncompare:1.5.0

cordova.cmd build android --release
The "" tags were detected and are no longer supported. Please migrate to the "preference" tag "AndroidWindowSplashScreenAnimatedIcon".
cordova-plugin-androidx-adapter: Processed 34 source files in 588ms
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\iamsh\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=C:\android-sdk-windows (DEPRECATED)
Using Android SDK: C:\android-sdk-windows
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Webtrikon\quickchicken\platforms\android\build.gradle' line: 21
What went wrong:
A problem occurred evaluating root project 'Quick Chicken'.
Could not resolve all files for configuration 'classpath'.
Could not resolve io.github.g00fy2:versioncompare:1.5.0.
Required by:
unspecified:unspecified:unspecified
> Could not resolve io.github.g00fy2:versioncompare:1.5.0.
> Could not get resource 'https://repo.maven.apache.org/maven2/io/github/g00fy2/versioncompare/1.5.0/versioncompare-1.5.0.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/io/github/g00fy2/versioncompare/1.5.0/versioncompare-1.5.0.pom'.
> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4.2/userguide/build_environment.html#gradle_system_properties
> Remote host terminated the 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
Command failed with exit code 1: C:\Webtrikon\quickchicken\platforms\android\gradlew :app:bundleRelease -b C:\Webtrikon\quickchicken\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
how to solve this error, Stuck with it from past 4 days.

can't build spring boot application using gradle and ipv6 network

I am trying to build a spring boot application in a VM with ipv6 network using Gradle, I seccedded to download the wrapper using this command :
sh gradlew -Djava.net.preferIPv6Addresses=true clean bootWar -Pstage
But I got the following issue :
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':buildSrc:runtimeClasspath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
Required by:
project :buildSrc
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
> Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Network is unreachable
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Network is unreachable
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
> Could not get resource 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Could not GET 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
> Network is unreachable
PS:
the spring-boot-gradle-plugin is able to be downloaded using the wget command
I tried also to set some flags in JAVA_OPT like -Djava.net.preferIPv6Addresses=true and -Djava.net.preferIPv4Stack=true but nothing is changed

How to build groovy-2.5.8.jar?

I am trying to build following project
git clone --depth 1 --branch GROOVY_2_5_8 https://github.com/apache/groovy.git
with "gradle build" and there are following problems
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':codenarcTools'.
> Could not resolve all task dependencies for configuration ':codenarc'.
> Could not resolve com.googlecode:openbeans:1.0.
Required by:
project :
> Could not resolve com.googlecode:openbeans:1.0.
> Could not get resource 'https://dl.bintray.com/melix/thirdparty-apache/com/googlecode/openbeans/1.0/openbeans-1.0.pom'.
> Could not GET 'https://dl.bintray.com/melix/thirdparty-apache/com/googlecode/openbeans/1.0/openbeans-1.0.pom'. Received status code 403 from server: Forbidden
I need to build groovy-2.5.8.jar form sources, could you tell me how to do that? Thank you!

When i am trying to run my flutter app it getting an Error running gradle

i am getting an error when i trying to run the app. please help. The error in cmd is below -
Error running Gradle:
ProcessException: Process "C:\Flutter projects\FlatApp-Firebase-Flutter-master\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Flutter projects\FlatApp-Firebase-Flutter-master\android\app\build.gradle' line: 14
What went wrong:
A problem occurred evaluating project ':app'.
ASCII
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 14s
Command: C:\Flutter projects\FlatApp-Firebase-Flutter-master\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
line nine in app-build-gradle is below-
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
There could be many reasons for such a error. I had a similar error. I would suggest you to open your project in android studio and check your gradel versions. I see by the name of you app that you are using firebase. Some of those plugins use Androidx. So migrating your project to Androidx might help. Here's how to migrate your project to Androidx.
Hope it helps!
I had the same issue this may because of the incompatibility of Gradle versions.
I opened the android part in Android Studio and updated Gradle as recommended by Android Studio with Alt+Enter and it solved my problem.
I can elaborate more if you can post more details about it e.g your app/gradle file.

Maven repository down?

The maven repository appears to be down. Trying to fetch data from the following url results in an error:
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml
Is this temporary or does this have to do with crosswalk no longer being developed?
=> Errors executing Cordova commands:
While building Cordova app for platform Android:
Error:/Users/fullhdpixel/Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
> Could not resolve org.xwalk:xwalk_core_library:23+. Required by: :android:unspecified
> Could not resolve org.xwalk:xwalk_core_library:23+.
> Failed to list versions for org.xwalk:xwalk_core_library.
> Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml.
> Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
There is already an open issue in their jira and another one on github. I guess it should be fixed by tomorrow (monday) as none of their maintainers will work on a weekend, be patient.
As the project maintainers stated here there will be no new releases but the source and repos will still be available for development.
Edit:
You can find a workaround until the servers are up again here.
It seems all of https://download.01.org is down!!!
An error occurred while processing your request.
Reference #30.22688343.1504522521.5cd76e0

Resources