可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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. :)