You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

升级Build Tools与Compile SDK至Android-P后APK安装失败求助

Fixing "App not installed" Error After Upgrading to Android-P (API 28) Build Tools

Hey there, let's dig into this APK installation issue you're facing after upgrading your build environment. This is a common pain point when moving to newer Android API levels, so let's break down the fixes step by step:

1. Verify Signature Integrity & Configuration

First, rule out signature-related issues—this is a top culprit for "App not installed" errors after tooling upgrades:

  • Double-check your signingConfigs in build.gradle to ensure keystore paths, passwords, and aliases are correct. Newer Build Tools versions enforce stricter signature validation.
  • Use the Android SDK's apksigner tool to verify your APK's signature directly:
    apksigner verify --verbose your-app-release.apk
    
    This will flag any invalid or corrupted signatures that might be blocking installation.

2. Align Build Tools & Compile SDK Versions

Your current setup has a version mismatch: you're using compileSdkVersion 'android-P' (API 28) with buildToolsVersion '27.0.3' (API 27 tools). This incompatibility often causes silent compilation/installation failures.

  • Update your build tools to match API 28: set buildToolsVersion "28.0.3" (the stable build tools version for Android-P).
  • Sync your targetSdkVersion to 28 as well—keeping compile, target, and build tools versions aligned eliminates most cross-version conflicts.

Here's an adjusted snippet of your build.gradle to reflect this:

android {
    compileSdkVersion 28 // Use numeric API level for clarity (equivalent to 'android-P')
    buildToolsVersion "28.0.3"

    defaultConfig {
        applicationId "com.***.******"
        minSdkVersion 19
        targetSdkVersion 28 // Match compileSdkVersion
        // Rest of your default config...
    }
}

3. Resolve "drawable-28-alpha" Error When Downgrading

If you try to roll back to API 26, the error occurs because your project contains API 28-exclusive resource directories (like drawable-28). The API 26 compiler can't recognize these directories.

  • Option 1: Delete API 28-specific resource directories (e.g., drawable-28, values-v28) if you don't need API 28-specific adaptations.
  • Option 2: Migrate the resources in these directories to generic folders (like drawable or values) if they work across all supported API levels.
  • Option 3: Stick with API 28 as your compile SDK (recommended) to retain any high-version-specific features you've implemented.

4. Additional Troubleshooting Steps

  • Clean project cache: Run ./gradlew clean then rebuild your APK—stale cache files often cause unexpected installation failures.
  • Check device restrictions: Ensure your device has "Unknown sources" enabled (for Android 7.0 and below) or "Install unknown apps" allowed for your browser/IDE (Android 8.0+). Also, uninstall any existing version of the app on the device (even debug builds with different signatures).
  • Install via ADB for detailed errors: Use adb install -r your-app.apk to install the APK. ADB will output specific error codes (e.g., INSTALL_FAILED_UPDATE_INCOMPATIBLE, INSTALL_FAILED_INVALID_APK) that pinpoint exactly what's going wrong.

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

火山引擎 最新活动