Tag: fix

  • Fix “Error loading build artifacts” error (Android Studio after upgrade)

    Quick Guide Summary:

    • Fixes the “Error loading build artifacts” (redirect.txt) error when running an app on an emulator after upgrading Android Studio from Ladybug to Otter.
    • Run the AGP Upgrade Assistant to bump Gradle 8.10.2 → 8.13 and AGP 8.8.1 → 8.13.2 in gradle-wrapper.properties and libs.versions.toml.
    • Remove and re-add “Gradle-aware Make” under Edit Configurations → Before Launch, leaving the task field empty.

    Problem:

    After upgrading Android Studio from “Ladybug” to “Otter” I started getting the following error message when I run my app on my emulated test device:

    "Error loading build artifacts from: .../myProjectRootDir/app/build/intermediates/apk_ide_redirect_file/productionDebug/createProductionDebugApkListingFileRedirect/redirect.txt"

    Solution:

    First, I ran the AGP Upgrade Assistant, which updated 2 files:

    • .../myProjectRootDir/gradle/wrapper/gradle-wrapper.properties
      Distribution URL has been upgraded from distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip to distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
    • .../myProjectRootDir/gradle/libs.versions.toml
      AGP version updated from agp = '8.8.1' to agp = '8.13.2'

    And then, applied a “Run Configuration” Fix:

    1. Click the Edit Configurations dropdown (next to the “Play” button).
    2. Select your app configuration on the left.
    3. Scroll to the “Before Launch” section at the bottom.
    4. Remove “Gradle-aware Make” (select it and click the minus – button).
    5. Re-add it: Click +, select Gradle-aware Make, and leave the task field empty. Click OK.
    6. Click Apply -> OK.
    7. Run the app.

    Additional things to try if above suggestions weren’t sufficient to fix the issue:

    • Invalidate caches
    • Clean the build before re-running
    • Sync Gradle files