Home > front end >  xamarin issue uploading app to play store with android 12 set eported=true
xamarin issue uploading app to play store with android 12 set eported=true

Time:12-13

I am developing using Xamarin Forms and updated api to 31 and target framework to v12, uploading to the play store I am facing the error "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported". But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with the error "


CodePudding user response:

At first, you can run your project with the visual studio. And the VS will show you which component doesn't declare the android:exported attribute and cause the problem.

And there are two possibilities.

  1. One is the component was created by yourself, you can add the attribute in it such as [Service(Exported = false)].
  2. Ther other is the component was created by the nuget packages you added in your project. Such as some libraries about firebase and google service. In this condition, you can update the packages in your project to the version which is compatible with the Android 12 or just update to the last version to resolve the problem.

In addition, you said:

But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with the error

You can try to run it on the device or the emulator with the Android 12.0 version. And just as the message you received said: Bundle which has an activity, activity alias, service or broadcast receiver with intent filter,. A component(activity, service, boardcast receiver) used the intent filter and didn't declare the android:exported attribute will show the message. Not all the activities need to declare this attribute.

  • Related