Errors building

Hi:

I’m new at ionic and I’m having some problems building my first app. This is my problem:

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 resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.0.0.
Could not get resource ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.
Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.
Connect to dl.google.com:443 [dl.google.com/216.58.192.110] failed: Connection timed out: connect
Could not resolve com.android.tools.build:gradle:3.0.0.
Could not get resource ‘https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.
Could not GET ‘https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.

I tried to get the resource gradle-3.0.0.pom manually from the browser and I couldn’t. So I managed to get the file gradle-3.0.0.pom but I don’t know what to do with it. Please, can you help me to solve this??

Thanks

What command did you run? You could try the --no-fetch flag, that helped some people that got similar connection problems.

I run: ionic cordova build android (I’m using Windows)

Now I.m just tried: ionic cordova build android --no-fetch and nothing

Are you behind a firewall or proxy that can block this connection?

Please run in your project root ionic info and post the output.

I’m behind a proxy, but I’ve set the configuration. The problem is when I try to access via browser the url https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom it says that is not available.

ionic info:

cli packages: (C:\Users\fabio\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v6.11.0
npm  : 3.10.10
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

For me the link is working and it downloads gradle-3.0.0.pom.

So it should be a problem with your firewall or proxy. Are you in a business environment? If so, ask your security people if something in this url is blacklisted.

Well, I had a mistake on my proxy configuration but that was not the main problem. It seems that the download page:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
Is not available for my country (Cuba). After fixing my proxy configuration this is the error that comes up:
Download https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom

[Fatal Error] gradle-3.0.0.pom:2:10: Already seen doctype.

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 resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.0.0.
Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
Already seen doctype.
Could not resolve com.android.tools.build:gradle:3.0.0.
Could not get resource ‘https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.
Could not HEAD ‘https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’. Received status code 504 from server: Gateway Time-out
Could not resolve com.android.tools.build:gradle:3.0.0.
Failed to download SHA1 for resource ‘https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom’.
For input string: “<!”

  • 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

I would assume that you get some html code back.
For input string: "<!" maybe is the beginning of <!DOCTYPE html> so maybe the response of that request is a error page. You get a 504 error here, so Gateway Time-out. Maybe there are still problems with your proxy settings.

I don’t know what to do. I search for the url in my browser an it says that is not available for my country. My proxy config is fine now, I think that the html returned is from that page (the one which said Unavailable), The <! error is definitively because that page.

Is there any way of configure the build step avoiding the download of this features and put this file (gradle-3.0.0.pom which I already had) in a default directory in my computer?

You could try to install gradle by hand:

The problem was with my android version. That missing file was the program trying to download new versions. It couldn,t because it wasn’t available for me.

So I install manually a new version that I got and now works fine, thanks for everything!!

Hi fragnar,

I’m using nativescript i find similar issue as this.

But the only change is I can download the .pom files from browser but these are not accessible from terminal.

In your last comment you have mentioned “missing file was the program trying to download new versions” - can you give more details for this.

Thanks in Anticipation,
Pruthivi :slight_smile:

i fixed after changing my wifi connection and run below command

ionic cordova platform remove android
ionic cordova platform add android

then build the app
ionic cordova plaftorm build android