-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Preliminary JDK11 Support (#4567)
Context: https://issuetracker.google.com/issues/150189789 Context: https://developer.android.com/preview/features#signature-scheme-v4 Context: https://developer.android.com/preview/features#incremental Preliminary JDK 11 support. The Android SDK Build-tools r30.0.0-rc4 package currently requires JDK 11 in order to use `apksigner.jar`: Task "AndroidApkSigner" Task Parameter:ApkSignerJar=C:\Users\dlab14\android-toolchain\sdk\build-tools\30.0.0-rc4\lib\apksigner.jar … Task Parameter:ToolPath=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\bin Task Parameter:ManifestFile=obj\Release\android\AndroidManifest.xml C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\bin\java.exe -jar C:\Users\dlab14\android-toolchain\sdk\build-tools\30.0.0-rc4\lib\apksigner.jar sign --ks "C:\Users\dlab14\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 21 --max-sdk-version 29 "C:\A\vs2019xam00000Y-1\_work\1\s\bin\TestRelease\temp\BuildAotApplication AndÜmläüts_x86_64_True_True\bin\Release\UnnamedProject.UnnamedProject-Signed.apk" java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) … …\Xamarin.Android.Common.targets(2559,2): error MSB6006: "java.exe" exited with code 1. This could be triggered by using the Android SDK Manager to install Build-tools r30.0.0-rc4, then overriding the `$(AndroidSdkBuildToolsVersion)` MSBuild property in `App.csproj`: <PropertyGroup> <AndroidSdkBuildToolsVersion>30.0.0-rc4</AndroidSdkBuildToolsVersion> </PropertyGroup> Many previous commits have added support for JDK 11, e.g. d99facb, dcee2c8, 4742d50, 89f3dc1, and 895b7bc (among many others). Additionally, c8ab455 updated the build environment so that *both* JetBrains OpenJDK 1.8 and 11 were installed, though 1.8 was still used. Now it's time to "flip the build environment," and use JDK 11 to build the product, installers, and run (most) unit tests: * Update `azure-pipelines.yaml` and `azure-pipelines-oss.yaml` so that JDK 11 is used to build everything. * Update `xaprepare` so that when `$(JavaSdkDirectory)` isn't overridden, JDK 11 is used by default. * Override the `JI_JAVA_HOME` environment variable when preparing `external/Java.Interop` so that it uses the desired JDK. * Update the default `$(LatestSupportedJavaVersion)` value to 11.0.4, the version of the JDK we install. * Update the `<ValidateJavaVersions/>` task so that JDK 11 is required when `$(AndroidSdkBuildToolsVersion)` is >= r30. This will cause an XA0032 error if JDK 1.8 is used to build a project when `$(AndroidSdkBuildToolsVersion)` is >= r30. * `apksigner` from Build-tools r30 creates a new `.idsig` file next to the `.apk`. This is to enable a new `adb install --incremental` feature. Add the `.idsig` file to `@(FileWrites)`. * Update various unit test `.csproj` files to consistently `<Import/>` the `Configuration.props` file and use properties within it for default values. This in particular allowed building e.g. `samples/HelloWorld` to implicitly use JDK 11. * Increase "expected" times in `tests/msbuild-times-reference/MSBuildDeviceIntegration.csv` as JDK 11 appears to be slower than JDK 1.8 (🙁). * *Disable* support for `@(JavaSourceJar)` when JDK 11 is used. JDK 11 changes the HTML generated by the `javadoc` command, and we need to update our HTML parser to handle it. In the interest of expediency, disable this for now. The Android Designer integration tests continue to use JDK 1.8, as the Designer doesn't currently build under JDK 11. TODO: * Fix `@(JavaSourceJar)` support: #4789 * Allow Android Designer to work with JDK 11, run Designer integration tests using JDK 11. * Figure out how to not accidentally bitrot JDK 1.8 support. Co-authored-by: Jonathan Pryor <jonpryor@vt.edu> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Jonathan Pobst <jonathan.pobst@microsoft.com> Co-authored-by: Peter Collins <pecolli@microsoft.com>
- Loading branch information
1 parent
4175950
commit 6cd854c
Showing
25 changed files
with
219 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
### Preliminary JDK 11 Support | ||
|
||
Xamarin.Android can now use JDK 11 to build libraries and applications. | ||
|
||
JDK 11 is required in order to use Android SDK Build-tools r30, | ||
currently a release candidate. Future versions of the Android SDK | ||
*may* require JDK 11 for more scenarios. JDK 11 *is not required* | ||
at this point in time. | ||
|
||
Project authors can try switching to JDK 11 now to prepare | ||
potential future JDK 11 requirements. | ||
|
||
To do so: | ||
|
||
1. Install JDK 11, for example | ||
[JetBrains Runtime](https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime) | ||
|
||
2. Tell Xamarin.Android to use JDK 11. This can be done within | ||
[Visual Studio](https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/update-jdk?tabs=windows), | ||
or can be done by setting the the `$(JavaSdkDirectory)` MSBuild | ||
property to refer to the root of the JDK installation from (1). | ||
|
||
#### Known Issues | ||
|
||
When JDK 11 is used, the `@(JavaSourceJar)` Build action is not supported, | ||
and binding projects will not parse Javadoc to determine parameter names. | ||
This may result in different parameter names for existing bindings projects. | ||
Authors of bindings projects affected by this change are recommended to | ||
continue to use JDK 8 to build the bindings projects until this issue is | ||
resolved. | ||
|
||
The fix is being tracked as: https://github.com/xamarin/xamarin-android/issues/4789 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.