c# - 在 Xamarin Forms 中将 Android API 目标级别从 11 升级到 12

标签 c# android xamarin xamarin.forms xamarin.android

我正在使用 Xamarin Forms,并且根据 Google Play 商店要求 ( https://developer.android.com/google/play/requirements/target-sdk ) 需要将 Android SDK 级别从 11 升级到 12。我已向所有 Activity 、服务和应用程序中使用的接收器。还更新了 PendingIntent 标志的可变性。但是,当我运行该应用程序时,我收到错误。

~/Droid/obj/Debug/AndroidManifest.xml(5,5): Error AMM0000: /~Droid/obj/Debug/lp/95/jl/AndroidManifest.xml Warning: Namespace 'com.google.android.gms.analytics' used in: AndroidManifest.xml, AndroidManifest.xml. android:exported needs to be explicitly specified for element <service#crc643a9353f6fb65c51a.FirebaseService>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Directory 'obj/Debug/lp/95' is from 'Xamarin.GooglePlayServices.Analytics.Impl.dll'.

/~Droid/obj/Debug/AndroidManifest.xml(5,5): Error AMM0000: android:exported needs to be explicitly specified for element <service#crc643a9353f6fb65c51a.FirebaseIdService>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

/~Droid/obj/Debug/AndroidManifest.xml(5,5): Error AMM0000: android:exported needs to be explicitly specified for element <receiver#crc64df999be563077fc4.BootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

下面是我的应用程序中使用的 Nuget 包。

Nuget packages

关于如何解决此问题有什么建议吗?

最佳答案

这对您不起作用的明确原因是您的 Firebase 库,它们确实很古老。我很惊讶您在 Android 11 之前仍未遇到任何问题。

解决此问题的最佳方法是将以下库至少升级到以下版本:

Xamarin.Firebase.Analytics 120.0.1
Xamarin.Firebase.Analytics.Impl 116.3.0
Xamarin.Firebase.Messaging 123.0.3

关于c# - 在 Xamarin Forms 中将 Android API 目标级别从 11 升级到 12,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73878519/

相关文章:

c# - iOS 上的 SQLite - 从一个文件复制到另一个文件的 SQL

c# - Silverlight 套接字中的超时

java - 修改库时出现错误,因为无法解决 sun.misc.Unsafe

c# - Xamarin ADFS 库

c# - 有没有一种方法可以将两个 C# 属性合并为一个?

c# - .NET 相当于 Java 的 BufferedReader

java - 如何通过标签从HTML获取图像路径(使用Jsoup)

android - Spring Android 连接被拒绝 ECONNREFUSED

c# - 处理这两个依赖于另一个的异步方法的最佳方法是什么?

c# - Xamarin PureSocketCluster 多个程序集