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

Android Studio构建Debug APK时Gradle超时及提取APK无法安装求助

Fixes for Debug APK Installation & Gradle Build Stuck Issues

Hey there, I’ve dealt with these exact headaches before— let’s break down how to fix each problem:

1. Why the extracted Instant Run APK can’t be installed

Instant Run generates incremental, split APKs instead of a single complete package. These are designed only to work with the specific device and session you used to deploy via Instant Run, so they’ll throw "corrupted package" errors when installed elsewhere.

Fix:

  • Disable Instant Run first: Go to File > Settings > Build, Execution, Deployment > Instant Run and uncheck all options.
  • Restart Android Studio, then rebuild your project from scratch.

2. Gradle stuck when building Debug APK

This is usually tied to cached data, offline mode limitations, or compatibility issues. Try these steps in order:

  • Turn off Gradle Offline Mode:
    Head to File > Settings > Build, Execution, Deployment > Gradle and uncheck "Offline work". Sometimes offline mode can cause Gradle to hang if it’s missing cached dependencies that it needs to resolve for a full build.
  • Clean up cached files:
    1. Delete the .gradle folder in your project’s root directory.
    2. Delete the build folder inside your app module.
    3. Click Build > Clean Project, then Build > Rebuild Project.
  • Update Gradle to a stable version:
    Open your project-level build.gradle file and make sure you’re using a recent stable Gradle plugin version. For example:
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2' // Use a stable version compatible with your AS
    }
    
  • Temporarily disable Lint checks:
    Lint can sometimes slow down builds drastically. Add this to your app-level build.gradle to skip it temporarily:
    android {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }
    

Final Steps

Once you’ve fixed the Gradle stuck issue, go to Build > Build Bundle(s) / APK(s) > Build APK(s). This will generate a complete, installable Debug APK in app/build/outputs/apk/debug/ that works on any compatible device.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 04:44:24