简体   繁体   中英

ionic cordova run android is giving gradle error

When I hit ionic cordova run android the following is happening:

D:\Leraning\myApp>ionic cordova build android
> cordova build android
Android Studio project detected

Running command: "C:\Program Files\nodejs\node.exe" D:\Leraning\myApp\hooks\after_prepare\010_add_platform_class.js D:\Leraning\myApp

ANDROID_HOME=C:\Users\nagasatya.mandalapu\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details

在此处输入图片说明

I have gradle installed and I tried by killing and restarting, but seems the same error.

update

D:\Leraning\myApp\platforms\android>gradle clean

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.0.0.
     Required by:
         project :
      > 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'.
               > Connect to repo.jfrog.org:443 [repo.jfrog.org/34.233.3.28, repo.jfrog.org/52.86.234.14] failed: 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 1m 23s

D:\Leraning\myApp\platforms\android>

In the below part of the code from build.gradle

repositories {
   jcenter()
     maven {
       url 'https://maven.google.com'
     }
}

Replace

maven {
url 'https://maven.google.com'
}

with

google()

Final part would be

repositories {
   jcenter()
   google()
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM