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
OpenRun > 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:- Go to
File > Invalidate Caches..., check "Invalidate and Restart", then restart Android Studio. - Manually delete the
.gradlefolder at your project root and theapp/buildfolder, then click the "Sync Project with Gradle Files" button (the elephant icon in the toolbar) to rebuild the project structure.
- Go to
Verify APK output path configuration
Open yourapp/build.gradlefile, check thebuildTypes > debugblock 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:dependenciesto generate a dependency tree, then look for entries starting withorg.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:- Check your project root
build.gradle—remove any Kotlin plugin declarations likeid 'org.jetbrains.kotlin.android' version 'x.x.x' apply falseif you don’t need them. - In your
app/build.gradle, add this to explicitly disable Kotlin auto-configuration:android { kotlinOptions { enabled = false } }
- Check your project root
Refresh dependencies
Corrupted dependency caches can cause Kotlin library resolution failures. Run./gradlew clean build --refresh-dependenciesto clear old caches and redownload all dependencies from scratch.
内容的提问来源于stack exchange,提问作者Skullper

