Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

AGP 8.11.1 auto-selects build-tools 35.0.0 for compileSdk 35, which isn't commonly installed. This causes build failures in the Android native module.

Changes

  • src/Core/AndroidNative/maui/build.gradle

    • Bump compileSdk from 35 to 36
    • Add explicit buildToolsVersion "36.0.0" to override AGP's auto-selection
    • Bump targetSdk from 35 to 36
  • src/Core/AndroidNative/build.gradle

    • Replace deprecated buildDir with layout.buildDirectory (Gradle 8+ API)
  • eng/Versions.props

    • Remove IsDefault="True" from API 35 (only API 36 is default now)
    • Remove AndroidSdkBuildToolsVersion property (no longer needed)
  • eng/pipelines/common/ui-tests-build-sample.yml

    • Remove outdated FIXME comment about API 35
  • src/Provisioning/Provisioning.csproj

    • Remove build-tools provisioning line (gradle file now explicitly specifies version)
android {
    compileSdk 36
    buildToolsVersion "36.0.0"  // Override AGP auto-selection
    namespace "microsoft.maui"
    
    defaultConfig {
        minSdk 21
        targetSdk 36
        ...
    }
}

Explicit buildToolsVersion takes precedence over AGP inference, ensuring builds use an available version.

The AndroidSdkBuildToolsVersion MSBuild property has been removed as it's no longer necessary - the gradle file now directly manages the build-tools version. Build-tools can be installed through Android SDK Manager or other standard Android development tools as needed.

Original prompt

Create a PR with these changes. They should be good to go and need no further updates

**Chronological Review:** 1. Initial phase: User requested checkout of DecorView-Fix PR branch, rebase to main, and create test sample 2. First build attempt: BuildTasks failed with build-tools 35.0.0 not found error 3. Investigation phase: Determined AGP 8.11.1 tries to use build-tools 35.0.0 for compileSdk 35 4. First fix attempt: Changed compileSdk to 36, still failed until explicit buildToolsVersion added 5. Exploration phase: User asked to test AGP 9.x upgrade on new branch 6. AGP upgrade failure: Microsoft.Android.Sdk.Windows 36.1.12 incompatible with Gradle 9.x due to Kotlin type safety 7. Documentation phase: Created detailed bug reports for Microsoft Android SDK team 8. Final resolution: User decided on minimal build-tools fix approach 9. Branch creation: Created fix-android-build-tools-36 with surgical changes 10. Cleanup phase: Verified changes, removed untracked files from previous experiments

Intent Mapping:

  • Message 1: "checkout the following branch...rebase it to main, write a sample on the sandbox project" - Test DecorView-Fix PR
  • Message 2: "can you build the BuildTasks please" - Compile BuildTasks solution
  • Message 3: "just build it with debug please and then open the -windows.slnf in VS" - Build configuration clarification
  • [6 messages omitted in context]
  • "why do you like that better than option 2?" - Comparing fix approaches
  • "yes, please make that change and then lets see if it compiles" - Approve specific fix
  • "did we need to set buildToolsVersion or does just setting compileSdk do enough?" - Understanding fix necessity
  • "delete the artifacts folder before testing again" - Clean build verification
  • "why is buildtoolsversion needed now but never was before? please figure it out" - Root cause analysis
  • "so why doesn't bumping compileSdk to 36 cause it to try and use build-tools 36?" - Understanding AGP behavior
  • "what is AGP and should we bump AGP?" - Context on Android Gradle Plugin
  • "switch to the main branch, checkout a new branch, bump AGP and compileSDK and see if things build" - Test AGP upgrade path
  • "is agp 9.0 a good version to bump to? or should we try even higher?" - Version selection guidance
  • "are you sure it requires breaking changes? can you work on fixing our code so that AGP 9.2.0 works" - Challenge incompatibility claim
  • "are you positive about this? are you just blaming MSFT for your own inability to make this work?" - Verify technical accuracy
  • "can you summarize why you think it's not compatible" - Consolidate reasoning
  • "is there anything official you can find to indicate that Microsoft.Android.Sdk.Windows 36.1.12 doesn't support gradle 9" - Request documentation
  • "can you give me specific errors I can show someone from that team?" - Prepare bug report
  • "alright lets go with the build tools and compilesdk fix for now, can you create a new branch with those changes and make sure we are sync with origin main" - Final decision on approach
  • "sorry keep going" - Continue after interruption
  • "what are all the changes made? is there anything lingering or are these all the changes you made for build tools?" - Verify clean state
  • "yes please clean the untracked files we only want changes around updating gradle bits here" - Final cleanup request

Technical Inventory:

  • .NET 10.0.100 (net10.0)
  • Microsoft.Android.Sdk.Windows 36.1.12
  • Android Gradle Plugin (AGP) 8.11.1 (current stable)
  • Gradle 8.13
  • Android compileSdk/targetSdk levels (35 vs 36)
  • Android build-tools (33.0.0, 36.0.0 installed; 35.0.0 not installed)
  • Kotlin type safety in Gradle 9.x
  • MSBuild target system
  • Git workflow (branches, rebasing, cherry-picking)
  • DecorView-Fix PR: SafeArea padding handling for AdjustResize mode

Code Archaeology:

  • src/Core/AndroidNative/maui/build.gradle: Gradle configuration for MAUI Android native library (compileSdk, targetSdk, buildToolsVersion)
  • src/Core/AndroidNative/build.gradle: Top-level Gradle config (clean task with buildDir → layout.buildDirectory)
  • src/Core/AndroidNative/gradle/wrapper/gradle-wrapper.properties: Gradle version definition (8.13)
  • eng/Versions.props: MSBuild version properties (AndroidSdkBuildToolsVersion)
  • artifacts/obj/Core/Debug/net10.0-android36.0/gradle/net.android.init.gradle.kts: Generated Kotlin file causing AGP 9.x failures
  • src/Controls/samples/Controls.Sample.Sandbox/: Test files created for DecorView-Fix testing
  • KeyboardTestPage.xaml/.cs: Test page with multiple Entry fields
  • MainActivity.cs: Modified for AdjustResize mode
  • App.xaml.cs: Modified for Shell with bottom tabs

Progress Assessment:
Completed:

  • ✅ DecorView-Fix PR analyzed and rebased to main
  • ✅ Sandbox test sample created (on separate branch)
  • ✅ Root cause identified: AGP tries to use build-tools 35.0.0 for compileSdk 35
  • ✅ AGP 9.x upgrade tested and determined incompatible with current SDK
  • ✅ Bug reports created for Microsof...

Created from Copilot CLI via the copilot delegate command.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Copilot coding agent request Fix Android build failure by explicitly specifying build-tools 36.0.0 Jan 27, 2026
Copilot AI requested a review from PureWeen January 27, 2026 16:56
…35 references

- Update AndroidSdkBuildToolsVersion from 33.0.0 to 36.0.0 in eng/Versions.props
- Remove IsDefault="True" from API 35 (only API 36 should be default now)
- Remove outdated FIXME comment about API 35 from ui-tests-build-sample.yml

This aligns the MSBuild property with the explicit buildToolsVersion in build.gradle
and ensures provisioning scripts install the correct build-tools version.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
@PureWeen
Copy link
Member

PureWeen commented Jan 27, 2026

/azp run maui-pr-uitests, maui-pr-devicetests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

- Remove AndroidSdkBuildToolsVersion property from eng/Versions.props
- Remove build-tools provisioning line from src/Provisioning/Provisioning.csproj

The gradle file now explicitly specifies buildToolsVersion "36.0.0" directly,
making this MSBuild property unnecessary. Build-tools can be installed through
Android SDK Manager or other means as needed.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copilot AI requested a review from PureWeen January 27, 2026 20:08
@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@PureWeen PureWeen marked this pull request as ready for review January 27, 2026 20:49
@PureWeen PureWeen requested review from Copilot and rmarinho January 27, 2026 20:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Android build failures caused by Android Gradle Plugin (AGP) 8.11.1's auto-selection of build-tools 35.0.0, which isn't commonly installed. The solution bumps Android SDK from API 35 to API 36 and explicitly specifies build-tools 36.0.0 to override AGP's problematic inference behavior.

Changes:

  • Updated Android native module to use compileSdk/targetSdk 36 with explicit build-tools 36.0.0
  • Modernized Gradle build configuration to use Gradle 8+ APIs
  • Removed obsolete build-tools provisioning and MSBuild properties

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Core/AndroidNative/maui/build.gradle Bumped compileSdk/targetSdk to 36 and explicitly specified buildToolsVersion "36.0.0" to override AGP auto-selection
src/Core/AndroidNative/build.gradle Modernized Gradle API by replacing deprecated buildDir with layout.buildDirectory
eng/Versions.props Removed obsolete AndroidSdkBuildToolsVersion property and IsDefault="True" from API 35 (only API 36 is default)
eng/pipelines/common/ui-tests-build-sample.yml Removed outdated FIXME comment about API 35 build failures
src/Provisioning/Provisioning.csproj Removed build-tools provisioning entry (gradle now explicitly specifies version)


android {
compileSdk 35
compileSdk 36
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining why buildToolsVersion is explicitly specified here. This would help future maintainers understand that this is a workaround for AGP 8.11.1's auto-selection behavior, which tries to use build-tools 35.0.0 (which isn't commonly installed) when compileSdk is 35. The explicit version specification overrides AGP's inference and ensures builds use an available version.

Suggested change
compileSdk 36
compileSdk 36
// Explicitly specify buildToolsVersion to override AGP 8.11.1's auto-selection,
// which can otherwise choose a non-installed build-tools version (for example 35.0.0 when compileSdk is 35).

Copilot uses AI. Check for mistakes.
@PureWeen
Copy link
Member

/azp run maui-pr-uitests, maui-pr-devicetests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK to me if CI is green.

@PureWeen
Copy link
Member

  • failing tests unrelated

@PureWeen PureWeen merged commit a633cc9 into main Jan 29, 2026
158 of 163 checks passed
@PureWeen PureWeen deleted the copilot/physical-wren branch January 29, 2026 21:53
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.

3 participants