Skip to content

Commit 485e39b

Browse files
authored
[docs] Set $(AndroidApiLevel)=28 in Configuration.Override.props.in (#3149)
If you copy `Configuration.Override.props.in` to `Configuration.Override.props` and don't change `$(AndroidApiLevel)` from it's default value of 24, the `src/Mono.Android` build fails: obj/Debug/android-24/mcw/Java.Lang.Reflect.Parameter.cs(10,60): error CS0535: 'Parameter' does not implement interface member 'IAnnotatedElement.IsAnnotationPresent(Class)' The cause of this error is because the parameters to `api-merge.exe` are "wrong"; see also: 0778165: mono --debug=casts ../../bin/BuildDebug/api-merge.exe -o "obj/Debug/android-24/mcw/api.xml" -s '../../bin/BuildDebug/api/api-*.xml.in' \ ../../bin/BuildDebug/api/api-10.xml.in … \ --last-description=../../bin/BuildDebug/api/api-28.xml.in `api-merge.exe` uses `$(AndroidPlatformId)` to determine the Android API-level to generate `api.xml` for, and thus uses the default value of API-28 (from `Configuration.props`), while the subsequent `generator.exe` invocation reads the API-28 `api.xml` and generates code for `$(AndroidApiLevel)` (API-24), and this mismatch causes the CS0535 error. This is a classic Don't Do That™: the `$(AndroidApiLevel)`, `$(AndroidFrameworkVersion)`, and `$(AndroidPlatformId)` MSBuild properties *must* be synchronized with each other, but `$(AndroidPlatformId)` *wasn't even mentioned* -- making it hard to be kept in sync with the other values -- and (arguably) the comments did not sufficiently warn anybody that these values must be synchronized with each other. Update `$(AndroidApiLevel)` and `$(AndroidFrameworkVersion)` so that they correspond to the current latest stable version, so that if someone inadvertently copies just one of the values things are *less* likely to blow up. Additionally, add `$(AndroidPlatformId)` and add a comment to attempt to further clarify that these values must be kept updated together.
2 parents f9f5b6c + 7b46945 commit 485e39b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Configuration.Override.props.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4+
<!--
5+
AndroidApiLevel, AndroidFrameworkVersion, and AndroidPlatformId MUST be
6+
kept consistent with each other, lest Bad Things Happen™
7+
-->
48
<!-- The default Android API level to bind in src/Mono.Android -->
5-
<AndroidApiLevel>24</AndroidApiLevel>
9+
<AndroidApiLevel>28</AndroidApiLevel>
610
<!-- The Xamarin.Android $(TargetFrameworkVersion) value that corresponds to $(AndroidApiLevel) -->
7-
<AndroidFrameworkVersion>v7.0</AndroidFrameworkVersion>
11+
<AndroidFrameworkVersion>v9.0</AndroidFrameworkVersion>
12+
<!-- The default Android API "id" that corresponds to $(AndroidApiLevel) -->
13+
<AndroidPlatformId>28</AndroidPlatformId>
814

915
<!--
1016
Colon-separated list of ABIs to build the mono JIT for.

0 commit comments

Comments
 (0)