【错误记录】未安装该应用 ( 在 Android 12 之后 组件设置 android:exported=“false“ 属性 )
生活随笔
收集整理的這篇文章主要介紹了
【错误记录】未安装该应用 ( 在 Android 12 之后 组件设置 android:exported=“false“ 属性 )
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 一、報錯信息
- 二、解決方案
一、報錯信息
報錯信息 : 點擊應用圖標后 , 應用并未啟動 , 并彈出 " 未安裝該應用 " 提示信息 ;
二、解決方案
排查了一下相關地方 , 發現是上午處理 AndroidManifest.xml 清單文件合并 報錯時 , 導致的錯誤 ;
【錯誤記錄】Manifest 清單文件報錯 ( …required to specify an explicit value for android:exported when the … )
AndroidManifest.xml 清單文件內容為 :
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example"><uses-permission android:name="android.permission.INTERNET"/><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"><activityandroid:name=".MainActivity"android:exported="false"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>錯誤位置就是在 <activity> 節點中 , 設置了 android:exported="false" 屬性約束 , 這里不應該設置 false 值 , 應該設置為 true ;
修改后的 AndroidManifest.xml 清單文件內容為 :
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example"><uses-permission android:name="android.permission.INTERNET"/><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"><activityandroid:name=".MainActivity"android:exported="true"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>修改完畢后 , 應用正常啟動 ;
總結
以上是生活随笔為你收集整理的【错误记录】未安装该应用 ( 在 Android 12 之后 组件设置 android:exported=“false“ 属性 )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【错误记录】jcenter 移除问题 (
- 下一篇: 【错误记录】Ubuntu 修改 host