Rah*_*ati 133 flutter android-12
在 Android 12 中调试应用程序时,应用程序崩溃了。
Rah*_*ati 232
Android 12 要求您在主要 Activity 中添加一段代码
转到您的项目文件夹并打开 AndroidManifest.xml 文件
在活动中添加以下代码
android:exported="true"
参考:
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme">
</activity>
Run Code Online (Sandbox Code Playgroud)
eda*_*lvb 36
在AndroidManifest.xml添加android:exported="true":
<manifest ...>
<application ...>
<activity
android:exported="true"
Run Code Online (Sandbox Code Playgroud)
小智 14
在 Android 11 及更低版本中,在 AndroidManifest 中声明 Activity、Service 或 Broadcast 接收器时,您没有显式声明 android:exported。由于默认值为exported=true,因此当您不想向外界透露时,只需声明exported=false即可。
<activity android:name="com.example.app.backgroundService">
<intent-filter>
<action android:name="com.example.app.START_BACKGROUND" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
Android 12 更改:在 Android 12 设备上将 SDK API 31 (android 12) 设置为 Target sdk 的导出应用程序的显式声明必须在声明了意图过滤器的 Activity 等组件中显式声明导出。否则会出现如下错误,安装失败。
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.
Run Code Online (Sandbox Code Playgroud)
您必须明确声明导出,如下所示:
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.
Run Code Online (Sandbox Code Playgroud)
Intent-filter 是将应用程序组件暴露给外部的方法之一。这是因为我的应用程序的组件可以通过隐式意图的解析来执行。
另一方面,在很多情况下,它仅用于在我的应用程序内部执行具有隐式意图的组件,但由于未设置导出而暴露在外部,这可能会影响问题的解析隐含的意图。。
谢谢@rahul-kavati。
对于 Xamarin/MAUI 它是 的一个属性ActivityAttribute,像这样使用[Activity(Label = "MsalActivity", Exported = true)]
| 归档时间: |
|
| 查看次数: |
97480 次 |
| 最近记录: |