Skip to content

Release build failed with "cannot find symbol android.app.KeyguardManager.DeviceLockedStateListener, android.service.chooser.ChooserSession.StateListener" errors #10720

@Logan2014

Description

@Logan2014

Android framework version

net10.0-android

Affected platform version

.NET Core sdk version: 10.0.102

Description

After migration from .Net 9 to .Net 10 (net10.0-android36.1) I got this issue both on my local machine with VS 2026 18.2.1 and with Azure DevOps pipeline, trying to get release of my app.

Steps to Reproduce

Run release build for net10.0-android36.1 target

Did you find any workaround?

I tryed to turn off linker with <PublishTrimmed>False</PublishTrimmed> or <TrimMode>None</TrimMode> inside project file but this did not help me.

There is suggestion to "Recompile with -Xlint:deprecation for details." or "Recompile with -Xlint:unchecked for details." but I can't control java compilator parameters through .Net project settings.

Relevant log output

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	XAJVC0000	obj\Release\net10.0-android36.1\android\src\mono\android\app\KeyguardManager_DeviceLockedStateListenerImplementor.java:8: error: cannot find symbol
		android.app.KeyguardManager.DeviceLockedStateListener
		                           ^
  symbol:   class DeviceLockedStateListener
  location: class KeyguardManager
obj\Release\net10.0-android36.1\android\src\mono\android\service\chooser\ChooserSession_StateListenerImplementor.java:8: error: package android.service.chooser.ChooserSession does not exist
		android.service.chooser.ChooserSession.StateListener
		                                      ^
obj\Release\net10.0-android36.1\android\src\xamarin\android\net\ServerCertificateCustomValidator_TrustManager_FakeSSLSession.java:125: warning: [removal] getPeerCertificateChain() in SSLSession has been deprecated and marked for removal
	public javax.security.cert.X509Certificate[] getPeerCertificateChain ()
	                                             ^
obj\Release\net10.0-android36.1\android\src\xamarin\android\net\ServerCertificateCustomValidator_TrustManager_FakeSSLSession.java:125: warning: [removal] X509Certificate in javax.security.cert has been deprecated and marked for removal
	public javax.security.cert.X509Certificate[] getPeerCertificateChain ()
	                          ^
obj\Release\net10.0-android36.1\android\src\xamarin\android\net\ServerCertificateCustomValidator_TrustManager_FakeSSLSession.java:130: warning: [removal] X509Certificate in javax.security.cert has been deprecated and marked for removal
	private native javax.security.cert.X509Certificate[] n_getPeerCertificateChain ();
	                                  ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
3 warnings	DS.Droid	C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.1.2\tools\Xamarin.Android.Javac.targets	161

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions