Skip to content

Use sdkComponents.aapt2 API for executable path #1942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

minjun011026
Copy link

@minjun011026 minjun011026 commented Aug 13, 2025

What I have done and why

  • Previously, the aapt2 file path was manually constructed by concatenating the SDK directory path with the buildToolsVersion.
  • This was a temporary workaround, marked with a TODO to migrate once an official API became available.
aapt2Executable.set(
    // TODO: Replace with `sdkComponents.aapt2` when it's available in AGP
    //       https://issuetracker.google.com/issues/376815836
    componentsExtension.sdkComponents.sdkDirectory.map { directory ->
        directory.file(
            "${SdkConstants.FD_BUILD_TOOLS}/" +
                "${baseExtension.buildToolsVersion}/" +
                SdkConstants.FN_AAPT2,
        )
    }
)
  • This change replaces the manual path construction with the official Android Gradle Plugin (AGP) API: componentsExtension.sdkComponents.aapt2.
aapt2Executable.set(
    componentsExtension.sdkComponents.aapt2.flatMap { aapt2 ->
        aapt2.executable
    }
)

https://issuetracker.google.com/issues/376815836?pli=1

Update)

  • There are some issues with AGP 8.11.0 and Lint.

  • This issue can be temporarily resolved by ignoring the relevant section, but I don't think it's a fundamental solution.
    https://issuetracker.google.com/issues/430991549

  • I checked the release notes for AGP 8.12.0, but this issue was not in fixed Issues list.
    https://developer.android.com/build/releases/gradle-plugin

  • Since the issue was marked as new on July 30, it seems it has not been fixed yet.

  • Therefore, I downgraded the AGP version 8.11.1 to 8.10.1, which does not have this crash.
    I wanted to resolve this while staying on the latest possible version, but this seems to be beyond my control.

  • I modified it to a stable version and successfully performed the GitHub Actions build through it.
    Once a future release (e.g., 8.13.0 or later) includes a fix for this issue, we can safely upgrade again.

@minjun011026 minjun011026 requested a review from dturner as a code owner August 13, 2025 03:57
@minjun011026
Copy link
Author

I want to apologize for triggering too many GitHub Actions workflows recently. I’m new to using GitHub Actions and didn’t realize the impact it could have.
My eagerness to resolve the issue got ahead of me, and I’m sorry for any inconvenience this may have caused.

@Jaehwa-Noh
Copy link
Contributor

@minjun011026 Don't warry about that. Github action is pending until maintainer running action on your PR.

@minjun011026
Copy link
Author

minjun011026 commented Aug 18, 2025

@Jaehwa-Noh Ah, I see! Thank you for letting me know. I’ll be more mindful next time 🙏

@minjun011026 minjun011026 force-pushed the use-aapt2-component-api branch 2 times, most recently from 9e12482 to 80074de Compare August 19, 2025 05:35
@minjun011026 minjun011026 force-pushed the use-aapt2-component-api branch from 80074de to f80609f Compare August 19, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants