Commit fccdfda
[Tests] Bump default AGP to 9.1.0 for compileSdk 36 compatibility (#11043)
Fixes: #11042
## Summary
Bumps the default Android Gradle Plugin (AGP) version in the test infrastructure from **8.5.0** to **9.1.0** to fix Gradle test failures caused by an AGP/compileSdk version mismatch.
## Problem
The default `AgpVersion` was hardcoded to `8.5.0` in `AndroidGradleProject.cs`, while `CompileSdk` is dynamically derived from `XABuildConfig.AndroidDefaultTargetDotnetApiLevel` (now **36**). AGP 8.5.0 only supports up to compileSdk 34, causing a Gradle configuration-cache serialization crash in `MergeJavaResourceTask` for tests like `BuildMultipleModules(MonoVM)`.
See the [AGP compatibility table](https://d.android.com/r/tools/api-level-support) for details.
## Changes
- **`AndroidGradleProject.cs`**: Bump default `AgpVersion` from `"8.5.0"` → `"9.1.0"` and set default `GradleVersion` to `"9.1.0"`
- **`AndroidGradleProject.cs`**: Add optional `compileSdk` parameter to `CreateDefault` overload
- **`AndroidGradleProjectTests.cs`**: Fix `BindLibraryWithMultipleGradleVersions` — the AGP 8.5.0 test case now uses `compileSdk = 34` (within its supported range), while the AGP 9.0.0 case uses the current default
## Bump default Gradle version to 9.3.1 (minimum for AGP 9.1.0)
AGP 9.1.0 requires Gradle >= 9.3.1, not 9.1.0. The previous default
caused all Gradle-based tests to fail with:
'Minimum supported Gradle version is 9.3.1. Current version is 9.1.0.'
## Add android:exported="true" to test activity with intent filter
AGP 9.1.0 with compileSdk 36 enforces the Android 12 requirement that
activities with intent filters must explicitly declare android:exported.
The SetupDefaultApp() manifest template was missing this attribute,
causing BuildApp and BuildMultipleModules tests to fail with:
android:exported needs to be explicitly specified for element
<activity#com.example.TestModule.TestActivity>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>1 parent fa20c91 commit fccdfda
3 files changed
Lines changed: 12 additions & 9 deletions
File tree
- src/Xamarin.Android.Build.Tasks/Tests
- Xamarin.Android.Build.Tests
- Xamarin.ProjectTools/Android
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
| 586 | + | |
586 | 587 | | |
587 | 588 | | |
588 | | - | |
| 589 | + | |
589 | 590 | | |
590 | 591 | | |
591 | 592 | | |
| |||
595 | 596 | | |
596 | 597 | | |
597 | 598 | | |
598 | | - | |
| 599 | + | |
599 | 600 | | |
600 | | - | |
| 601 | + | |
601 | 602 | | |
602 | 603 | | |
603 | 604 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
0 commit comments