Android Studio 2.2.3 Gradle Build Running Stuck

时光总嘲笑我的痴心妄想 提交于 2019-12-17 21:08:23

问题


I download android studio 2.2.3 and load my project. But Gradle Build Running Stuck. It continuously shows that and i am not able to run my app. what is the issue can any one help me with that?

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

回答1:


If you are behind a proxy, create a gradle.properties file next to your build.gradle file with this :

systemProp.http.proxyHost=YOUR_PROXY
systemProp.http.proxyPort=YOUR_PORT
systemProp.http.proxyUser=USERNAME
systemProp.http.proxyPassword=PASSWORD

systemProp.https.proxyHost=YOUR_PROXY
systemProp.https.proxyPort=YOUR_PORT
systemProp.https.proxyUser=USERNAME
systemProp.https.proxyPassword=PASSWORD

systemProp.http[s].proxyUser and systemProp.http[s].proxyPassword are not required if you don't need to login for your proxy. In such a case, remove these lines.




回答2:


Make sure you have a internet connection.
If you have it , so maybe android studio couldn't download classes from Jcenter. So you have to force android studio to download classes from other resource like Maven.

To do that open gradle.build file and change the two jcenter() text with mavenCentral() ("C" in maven"C"entral() must be typed in uppercase) and try syncing with gradle again.

You don't need to do that every time you open your project. Just do this every time you create a new project in Android studio.




回答3:


Solutions: 1. update your Build tools. 2. Reinstall sdk.

In my case, all the executable ".exe" files in "sdk\build-tools\25.0.3" folder were corrupted by virus. solution 2 worked for my perfectly. :)



来源:https://stackoverflow.com/questions/41502164/android-studio-2-2-3-gradle-build-running-stuck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!