Skip to content

Commit 3558fd2

Browse files
dellis1972jonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] Warn wrt Google Play requirements (#1897)
Fixes: #1766 In August and November 2018, [Google will require][1] a minimum of `$(TargetFrameworkVersion)`=v8.0 to publish/update apps. This commit adds a new check to the `<ResolveSdks/>` task which will emit warnings when we hit those dates. This will only happen when `$(TargetFrameworkVersion)` < `v8.0` If you are not targeting the Google Play store and wish to hide these warnings, you can make use of the `/nowarn:XA0114,XA0113` command line switch. Alternatively, update your `.csproj` to include: <NoWarn>XA0114;XA0113</NoWarn> [1]: https://developer.android.com/distribute/best-practices/develop/target-sdk
1 parent f2275e1 commit 3558fd2

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

Documentation/guides/messages/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
+ [XA0110](xa0110.md): Disabling $(AndroidExplicitCrunch) as it is not supported by `aapt2`. If you wish to use $(AndroidExplicitCrunch) please set $(AndroidUseAapt2) to false.
3838
+ [XA0111](xa0111.md): Could not get the `aapt2` version. Please check it is installed correctly.
3939
+ [XA0112](xa0112.md): `aapt2` is not installed. Disabling `aapt2` support. Please check it is installed correctly.
40+
+ [XA0113](xa0113.md): Google Play requires that new applications must use a `$(TargetFrameworkVersion)` of v8.0 (API level 26) or above.
41+
+ [XA0114](xa0114.md): Google Play requires that application updates must use a `$(TargetFrameworkVersion)` of v8.0 (API level 26) or above.
4042

4143
### XA1xxx Project Related
4244

@@ -59,4 +61,4 @@
5961

6062
### XA8xxx Reserved
6163

62-
### XA9xxx Licensing
64+
### XA9xxx Licensing
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Compiler Warning XA0113
2+
3+
As of August 1st 2018 any new application uploaded to the google play
4+
store needs to target v8.0 (API 26) or above. If you are seeing this
5+
warning, you should update the `$(TargetFrameworkVersion)` of your projects
6+
to be v8.0 or above.
7+
8+
If you are not targeting the Google Play store and wish to hide these
9+
warnings you can make use of the `/nowarn:XA0113` command line switch.
10+
Alternatively add
11+
12+
<NoWarn>XA0113</NoWarn>
13+
14+
to your .csproj.
15+
16+
[Google Play's target API level requirement](https://developer.android.com/distribute/best-practices/develop/target-sdk)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Compiler Warning XA0114
2+
3+
As of November 1st 2018 any application update uploaded to the google play
4+
store needs to target v8.0 (API 26) or above. If you are seeing this
5+
warning, you should update the `$(TargetFrameworkVersion)` of your projects
6+
to be v8.0 or above.
7+
8+
If you are not targeting the Google Play store and wish to hide these
9+
warnings you can make use of the `/nowarn:XA0114` command line switch.
10+
Alternatively add
11+
12+
<NoWarn>XA0114</NoWarn>
13+
14+
to your .csproj.
15+
16+
[Google Play's target API level requirement](https://developer.android.com/distribute/best-practices/develop/target-sdk)

src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ public bool RunTask ()
309309
return false;
310310
}
311311

312+
int apiLevel;
313+
if (int.TryParse (AndroidApiLevel, out apiLevel)) {
314+
if (apiLevel < 26)
315+
Log.LogCodedWarning ("XA0113", $"Google Play requires that new applications must use a TargetFrameworkVersion of v8.0 (API level 26) or above. You are currently targeting {TargetFrameworkVersion} (API level {AndroidApiLevel}).");
316+
if (apiLevel < 26)
317+
Log.LogCodedWarning ("XA0114", $"Google Play requires that application updates must use a TargetFrameworkVersion of v8.0 (API level 26) or above. You are currently targeting {TargetFrameworkVersion} (API level {AndroidApiLevel}).");
318+
}
319+
312320
SequencePointsMode mode;
313321
if (!Aot.TryGetSequencePointsMode (SequencePointsMode ?? "None", out mode))
314322
Log.LogCodedError ("XA0104", "Invalid Sequence Point mode: {0}", SequencePointsMode);

0 commit comments

Comments
 (0)