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

Android Studio 3.1问题求助:APK安装失败及Kotlin标准库异常

Hey there, let's tackle your two Android development issues one by one with practical fixes:

问题1:Debug APK安装失败及需手动执行assembleDebug的问题

It sounds like your IDE's build pipeline is skipping critical steps or encountering cached corruption. Here are targeted solutions:

  • Fix your Run/Debug configuration
    Open Run > Edit Configurations, select your app's debug configuration. Check the "Before Launch" section—make sure it includes Gradle-aware Make (not just a custom Gradle task). If it's missing, click the + button, add "Gradle-aware Make", save the configuration, and try running again. This ensures the full build pipeline runs before installation.

  • Reset build caches
    Corrupted caches often cause manifest parsing errors or missing APKs:

    1. Go to File > Invalidate Caches..., check "Invalidate and Restart", then restart Android Studio.
    2. Manually delete the .gradle folder at your project root and the app/build folder, then click the "Sync Project with Gradle Files" button (the elephant icon in the toolbar) to rebuild the project structure.
  • Verify APK output path configuration
    Open your app/build.gradle file, check the buildTypes > debug block to ensure the output path matches the one in your error message (/home/skullper/AndroidStudioProjects/app_pay/app/build/outputs/apk/app-debug.apk):

    android {
        buildTypes {
            debug {
                applicationVariants.all { variant ->
                    variant.outputs.all {
                        outputFileName = "app-debug.apk"
                        // If you've customized the output directory, double-check it here
                    }
                }
            }
        }
    }
    

    Sync the project after making any adjustments.

问题2:纯Java项目出现Kotlin标准库相关问题

Since your description was cut off, I’ll cover the most common causes and fixes for this scenario:

  • Check for hidden Kotlin dependencies
    Some third-party libraries (like newer Google services or open-source SDKs) are built with Kotlin and automatically pull in the Kotlin standard library. Run ./gradlew app:dependencies to generate a dependency tree, then look for entries starting with org.jetbrains.kotlin:. If you don’t need the Kotlin-dependent library, replace it with a pure Java alternative; if you must keep it, your project will still work—you just need to ensure the Kotlin dependencies are resolved correctly.

  • Adjust Android Gradle Plugin (AGP) settings
    Newer AGP versions (7.0+) may enable Kotlin-related configurations by default, even for pure Java projects:

    1. Check your project root build.gradle—remove any Kotlin plugin declarations like id 'org.jetbrains.kotlin.android' version 'x.x.x' apply false if you don’t need them.
    2. In your app/build.gradle, add this to explicitly disable Kotlin auto-configuration:
      android {
          kotlinOptions {
              enabled = false
          }
      }
      
  • Refresh dependencies
    Corrupted dependency caches can cause Kotlin library resolution failures. Run ./gradlew clean build --refresh-dependencies to clear old caches and redownload all dependencies from scratch.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 06:56:41