Android Studio stuck on gradle resolving dependencies

后端 未结 15 1139
臣服心动
臣服心动 2020-12-04 22:11

I\'m new to Android Studio and while creating a new project it stuck at resolving dependencies :app:_debugCompile.

I waited for sometime and even tried

相关标签:
15条回答
  • 2020-12-04 22:23

    Try looking at Gradle debug output. (My guess is IDE is not able to get to jcenter repository). Here is what you can try.

    1. Go to Settings> Compiler(Gradle-Based Android Project)
    2. In Command-line Options, add "--stacktrace --debug"
    3. Build your project
    4. Click and look at Gradle Console on the bottom right. You should see where gradle is choking up.

    How does your module "build.gradle" look like? you might want to add "mavenCentral()" under repositories block. (assuming you have dependencies that are found there)

    0 讨论(0)
  • 2020-12-04 22:27

    I solved this by going to AppName\app -> open build.gradle and replace the dependencies part with:

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:multidex:1.0.0'
    }
    

    You'll have to do this for every app you create but after this they will load fine.

    I do it this way:

    1. Create new project
    2. Wait for it to get stuck
    3. Exit Android Studio
    4. Do the modifications above
    5. Open project
    0 讨论(0)
  • 2020-12-04 22:34

    In my case, I imported the project which was created by someone else. For me it was proxy set in gradle.properties file of the project. I commented below lines in gradle.properties and it worked fine.

    #systemProp.https.proxyPort=8080
    #systemProp.http.proxyHost=10.10.11.12
    #systemProp.https.proxyHost=10.10.11.12
    #systemProp.http.proxyPort=8080
    
    0 讨论(0)
  • 2020-12-04 22:35

    I had the same issue, and I just let it go for 30 mins. Then it started working after that.

    It was also resolving other stuff after "_debugCompile".

    0 讨论(0)
  • 2020-12-04 22:35
    1. Cancel the Gradle build when its taking long time.

    2. Check the HTTP proxy settings in File-> Settings-> Appearance & Behavior -> System Settings -> HTTP Proxy. Verify using "Check connection"

    3. If fine, remove the android test compile and/or unit test build from app/build.gradle file e.g remove the below line

      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' })

    0 讨论(0)
  • 2020-12-04 22:35

    resolving dependencies is taking too much time because it is trying to download some files to build successfully. With proper bandwidth, it can be removed. Here, I am discussing what I did with my project on the android studio:

    1. Open the terminal in Android Studio.

    2. Move to your project's android folder with the help of terminal command cd it might be something like: YourProjectNameHere\, if you are working on flutter then this might be like: YourProjectNameHere\android\.

    3. run the grdlew by typing gradlew in the terminal.

    4. Let it finish or abort with some error. Don't interrupt the process. You can see on your terminal that few files are downloading.

    5. if again there is an error, read the error carefully, you can figure it out where is the error and what's the error. And go to step 3. until it finishes build successfully.

    P.S.: if gradlew command is unable to download few files due to some reason, you can download it manually by using your favourite browser.

    0 讨论(0)
提交回复
热议问题