Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error CS2044: /sourcelink switch is only supported when emitting PDB, error CS2045: /embed switch is only supported when emitting a PDB., Java SDK default drop to version 1.8.0 #8837

Closed
2 of 10 tasks
denisyakimov07 opened this issue Nov 17, 2023 · 5 comments

Comments

@denisyakimov07
Copy link

Description

After release 20231115.2.0 my Android build started falling.
The reason: the Java SDK for default became Java SDK version 1.8.0

Image version: '20231115.2.0'

image

Image version: '20231029.1.0'

image

The first problem I am working around is setting up Java SDK version manually.
image

After fix, we started to see other problems during the production Android build.

CSC : error CS2044: /sourcelink switch is only supported when emitting PDB. [D:\a\1\s\************************.csproj]
CSC : error CS2045: /embed switch is only supported when emitting a PDB. [D:\a\1\s\*************************.csproj]

There are no changes in the source code between builds.
Some default settings are missing in the new image.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • macOS 13
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20231115.2.0

Is it regression?

20231029.1.0

Expected behavior

Remove default flag PDB for - task: XamarinAndroid@1

Actual behavior

Flag is enabled PDB for - task: XamarinAndroid@1

Repro steps

  • task: XamarinAndroid@1 failing

image

@mikhailkoliada
Copy link
Contributor

Hey, we will take a look

@denisyakimov07
Copy link
Author

I was able to fix the Error CS2044 and error CS2045.

After research, we can see the difference in 2 runs.

image version: '20231115.2.0'

image

image version: '20231029.1.0'

image

In my case, one of the dependent projects had no release configuration, debug only. Another project was fixed when i add

    <DebugType>None</DebugType>
    <DebugSymbols>false</DebugSymbols>

image

@gtbuchanan
Copy link

gtbuchanan commented Nov 17, 2023

I can confirm this broke all of our Xamarin Android builds with the following error:

15:14:14 [DBG] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(254,5): error XA0031: Java SDK 11.0 or above is required when using $(TargetFrameworkVersion) v13.0. [D:\a\1\s\src\**redacted**.csproj::TargetFramework=MonoAndroid13.0]
15:14:14 [DBG] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(254,5): error XA0031: Download the latest JDK at: https://aka.ms/msopenjdk [D:\a\1\s\src\**redacted**.csproj::TargetFramework=MonoAndroid13.0]
15:14:14 [DBG] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(254,5): error XA0031: Note: the Android Designer is incompatible with Java SDK 11.0: https://aka.ms/vs2019-and-jdk-11 [D:\a\1\s\src\**redacted**.csproj::TargetFramework=MonoAndroid13.0]

We don't use the task. We use raw MSBuild. Here's an internal link:

https://dev.azure.com/energyworldnet/proddev/_build/results?buildId=13228&view=logs&s=7d4e458d-e0e0-5f89-c72d-7371ef61b09b

@mikhailkoliada mikhailkoliada self-assigned this Nov 18, 2023
@mikhailkoliada
Copy link
Contributor

Hello! The xamarin components of VS 17.8 started to require JDK 11 it seems, the default JDK version on the windows-2022 image is 8 so that's why you started seeing this error. You should not rely on the JDK version image set as default and did right with JavaToolInstaller@0 usage (alternatively the actions/setup-java should be used if one is using GitHub Actions rather than Azure DevOps). It looks like nothing actable for us left here, so I am going to close the issue, feel free to reach us out again if some other questions left.

@gtbuchanan
Copy link

I've confirmed that running the JavaToolInstaller task before building our Xamarin projects fixed our issues on both Linux and Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants