在android 12中调试应用程序时,该应用程序正在崩溃。
发布于 2022-01-16 18:55:06
谢谢拉胡尔-卡瓦蒂。
对于Xamarin/MAUI,它是ActivityAttribute上的一个属性,类似于下面的[Activity(Label = "MsalActivity", Exported = true)]
发布于 2022-05-03 16:01:25
在Android11和更低版本中,当在AndroidManifest中声明活动、服务或广播接收器时,您没有显式声明Android :导出。因为默认值是exported=true,所以当您不想向外部透露时,只需要声明exported=false。
<activity android:name="com.example.app.backgroundService">
<intent-filter>
<action android:name="com.example.app.START_BACKGROUND" />
</intent-filter>
</activity>Android 12更改:在Android 12设备上,将SDK 31 (Android12)设置为目标sdk的导出应用程序的显式声明必须在声明意图过滤器的活动等组件中显式声明导出。否则,发生下列错误,则安装失败。
Targeting S+ (version 10000 and above) requires that an explicit value for
android:exported be defined when intent filters are present
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
Even for apps targeting SDK API 31, components without intent-filter can omit the exported declaration.您必须显式声明导出如下:
<service android:name="com.example.app.backgroundService"
android:exported="false">
<intent-filter>
<action android:name="com.example.app.START_BACKGROUND" />
</intent-filter>
</service>意图过滤器是向外部公开应用程序组件的方法之一。这是因为我的应用程序的组件可以通过解析隐式意图来执行。
另一方面,在许多情况下,它只用于执行只在我的应用程序中具有隐式意图的组件,但由于未设置导出,所以它暴露在外部,这可能会影响隐式意图的解决。。
发布于 2022-06-21 16:21:38
在Xamarin.Android中,我在BroadcastReceiver中也遇到了同样的问题:
[BroadcastReceiver(Enabled = true, Exported =true)]
[IntentFilter(new[] { BluetoothDevice.ActionFound, BluetoothDevice .ActionUuid, BluetoothDevice .ExtraRssi})]
public class BleReceiver : BroadcastReceiver
并且用相同的Exported=true解决了
https://stackoverflow.com/questions/70333565
复制相似问题