android - xamarin.forms (android) 无法更新 appstore 中的应用程序 "android:exported"属性缺失

标签 android xamarin.forms

到今天为止,一定发生了一些变化,因为我们无法在应用商店中更新我们的应用。

我们在上传时收到此错误:

Warning: If an activity, service, or broadcast receiver uses intent filters and doesn't have an explicitly-declared value for android:exported, your app can't be installed on a device that runs Android 12 or higher.

在文档中给出了有关如何解决此问题的示例:

<service android:name="com.example.app.backgroundService"
         android:exported="false">
    <intent-filter>
        <action android:name="com.example.app.START_BACKGROUND" />
    </intent-filter>
</service>

问题是,这是关于 java 和 android studio,但不能很好地转化为 xamarin.forms。

这是我的 list :

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.172" package="com.interiorcircle.interiorcircledroid" android:installLocation="auto" android:versionCode="329">
    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="31" />
    <application android:label="Interior Circle" android:theme="@style/MainTheme" android:icon="@mipmap/launcher_foreground">
        <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
        </provider>
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="asd" />
    </application>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-feature android:name="android.hardware.location" android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" android:required="false" />
    <uses-feature android:name="android.hardware.location.network" android:required="false" />
</manifest>

编辑:

我注意到他的 obj 文件夹构建在 list 中,这里没有相关属性:

<service android:name="crc6494e14b9856016c30.PNFirebaseMessagingService">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <receiver android:name="crc6494e14b9856016c30.PushNotificationActionReceiver" />
    <receiver android:name="crc6494e14b9856016c30.PushNotificationDeletedReceiver" />
    <activity android:configChanges="orientation|screenSize|uiMode" android:name="crc646957603ea1820544.MediaPickerActivity" />

有没有人有过类似的经历,也许已经解决了这个问题?

最佳答案

正如我在问题中发现的那样,问题是由 firebase nuget 包产生的,它只是缺少 android:exported 属性。

但是,您可以通过将此行添加到应用程序标记之间的 list 中来添加它:

<receiver android:name="crc6494e14b9856016c30.PNFirebaseMessagingService" android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</receiver>

因为这是一个任意的命名空间,它可能不会永远有效,所以请记住这个命名空间可能会改变。

我还针对这个确切问题打开了一个 git issue,以便开发人员可以自行修复它。

最佳

关于android - xamarin.forms (android) 无法更新 appstore 中的应用程序 "android:exported"属性缺失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70740049/

相关文章:

c# - Xamarin 表单 - 异步 ContentPage

c# xamarin forms 主详细信息页面 MVVM

android - Textviews 与 edittext android 相去甚远

java - 忽略 RuntimeTypeAdapterFactory 中未注册的子类型

c# - Xamarin 表格 : how to receive images without storing anywhere locally?

c# - 将多个 ContentView 放在一个 ScrollView 中

xamarin.forms - IServiceProvider 在 .NET Standard 中不可用?

android - 计时器异常 - java.lang.RuntimeException : Can't create handler inside thread that has not called Looper. prepare() - Android

java - 找不到参数的方法实现() [com.google.firebase :firebase-core:16. 0.1]

java - 类注释导致ClassNotFound异常