Gradle Build issues

Good day beautiful people. I am new to flutter. For the past 4 days, i have been trying build my first flutter project and here is what i see in my android studio.


* 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 192.168.43.253:80 [/192.168.43.253] 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 192.168.43.253:80 [/192.168.43.253] failed: Connection refused: connect 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://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > Connect to 192.168.43.253:80 [/192.168.43.253] failed: Connection refused: connect > 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'. > Connect to 192.168.43.253:80 [/192.168.43.253] 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](https://help.gradle.org/) BUILD FAILED in 52s Exception: Gradle task assembleDebug failed with exit code 1***```

Can anyone help me with this issue?

Hi @UDO_IGWE_UCHECHUKWU, could you post your pubspec, Flutter version and the android emulators model you are using please.

PUBSPEC


description: A new Flutter project.

# The following line prevents the package from being accidentally published to

# pub.dev using `pub publish`. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.

# A version number is three numbers separated by dots, like 1.2.43

# followed by an optional build number separated by a +.

# Both the version and the builder number may be overridden in flutter

# build by specifying --build-name and --build-number, respectively.

# In Android, build-name is used as versionName while build-number used as versionCode.

# Read more about Android versioning at https://developer.android.com/studio/publish/versioning

# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.

# Read more about iOS versioning at

# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 1.0.0+1

environment:

  sdk: ">=2.7.0 <3.0.0"

dependencies:

  flutter:

    sdk: flutter

  # The following adds the Cupertino Icons font to your application.

  # Use with the CupertinoIcons class for iOS style icons.

  cupertino_icons: ^0.1.3

dev_dependencies:

  flutter_test:

    sdk: flutter

# For information on the generic Dart part of this file, see the

# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.

flutter:

  # The following line ensures that the Material Icons font is

  # included with your application, so that you can use the icons in

  # the material Icons class.

  uses-material-design: true

  # To add assets to your application, add an assets section, like this:

  # assets:

  #   - images/a_dot_burr.jpeg

  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see

  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see

  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,

  # in this "flutter" section. Each entry in this list should have a

  # "family" key with the font family name, and a "fonts" key with a

  # list giving the asset and other descriptors for the font. For

  # example:

  # fonts:

  #   - family: Schyler

  #     fonts:

  #       - asset: fonts/Schyler-Regular.ttf

  #       - asset: fonts/Schyler-Italic.ttf

  #         style: italic

  #   - family: Trajan Pro

  #     fonts:

  #       - asset: fonts/TrajanPro.ttf

  #       - asset: fonts/TrajanPro_Bold.ttf

  #         weight: 700

  #

  # For details regarding fonts from package dependencies,

  # see https://flutter.dev/custom-fonts/#from-packages```

Flutter version:
1.20.3

Android Emulator:
Nexus 4 API 22

@UDO_IGWE_UCHECHUKWU if you can edit your first response, please and put all the pubspec between ``` so appears as code. Like this:

THIS IS HOW IT WILL LOOK. 
Yo need to add ```at the top, and at the bottom for closure.
Or select everything and click the `Preformatted text` icon on the Toolbar. 
Is the blank one, the one with no Icon (At least in my case ahahha). 

Ok so I see you are not importing any packages in the project, so I assume you haven’t touch any of the code in the native folders (android and ios) right?

Hello @F.lucadetena, I want to thank you so much for the time UV spend trying to help me out with this nightmare. I have been on this issue for more than a week now. No body has replied me on stack overflow on this issue. Please kindly observe the changes on the PUBSPEC file as u wanted. See if you could make something out of it.

I haven’t really touched or imported any dependencies in the pubspec file. I felt everything should be done when the project is fully built through GRADLE. Well, please see if you could make something out. I am almost running mad as I want to start enjoying the power of flutter as you guys.

Thanks for your concern.

1 Like

Hi @UDO_IGWE_UCHECHUKWU I completely understand how frustrating this things are. Although I haven’t have this problems with Flutter, I have experience then with other frameworks, and it is very frustrating. I’m so sorry you are going through this and hope this doesn’t make you abandone Flutter. It is a greate framework. Let’s do something. I’ll send you a private message with my mail. Send me an email with times that you can talk on zoom tomorrow, and as soon as I wake up will try to make it work. Please with the times let me know in what time zone you live so we coordinate well. Don’t worry more about the problem, we will find a solution :wink:

1 Like

Thanks @F.lucadetena!!! I will assess the mail right away.