You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio项目跨电脑迁移后构建卡顿,卡在GIF库下载环节

Hey there, let’s fix this frustrating stuck download issue once and for all! I’ve run into this exact problem when moving Android Studio projects between machines, so I’ve got a few tried-and-true solutions for you.

解决Android Studio迁移项目后卡在GIF库下载的问题

1. 迁移本地Gradle缓存(最快的解决办法)

Your old computer already had all the downloaded dependencies stored in Gradle’s local cache—we can just copy that over to the new machine to avoid re-downloading everything:

  • On your old computer, find the Gradle cache folder:
    • Mac/Linux: ~/.gradle/caches
    • Windows: C:\Users\<Your Username>\.gradle\caches
  • Copy the entire caches folder to the exact same path on your new computer (overwrite the existing folder if it’s already there)
  • Restart Android Studio and re-build your project—it should pull dependencies straight from the local cache instead of trying to download them

2. Switch to a faster Maven mirror

If you didn’t back up the cache, the default MavenCentral/JCenter servers are probably slow for your location. Let’s swap in a domestic mirror to speed up downloads:
Open your project’s root build.gradle file, find the repositories block, and replace it with:

repositories {
    maven { url 'https://maven.aliyun.com/repository/public/' }
    maven { url 'https://maven.aliyun.com/repository/google/' }
    maven { url 'https://maven.aliyun.com/repository/jcenter/' }
    google()
    mavenCentral()
}

Also double-check your module’s build.gradle to make sure the GIF library dependency is spelled correctly—for example, the common one is:

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.28'

3. Force refresh Gradle caches

Sometimes Gradle gets stuck with stale cache data. Let’s wipe and restart:

  • Click the Sync Project with Gradle Files button (the refresh icon next to the elephant in the top-right corner)
  • If that doesn’t work, go to File > Invalidate Caches..., check "Invalidate and Restart", and let Android Studio reboot completely

4. Manually add the GIF library as a local dependency

If all else fails, you can download the library directly and add it to your project:

  • Find the exact version of the GIF library your project uses (check your module’s build.gradle), then download the corresponding .aar file from a Maven repository
  • Create a libs folder in your module’s directory, and drop the .aar file into it
  • Update your module’s build.gradle:
repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation(name: 'android-gif-drawable-1.2.28', ext: 'aar')
}

Make sure the name matches the .aar file you downloaded!

Quick final check

Ensure your new Android Studio has the same SDK version, Build Tools version, and NDK (if used) as your old machine—you can find these in File > Project Structure on the original computer, then install them on the new one via the SDK Manager. Missing tools can also cause stuck builds.

内容的提问来源于stack exchange,提问作者nerdydicaprio

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:49:40