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
}
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.
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.
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