【错误记录】未安装该应用 ( 在 Android 12 之后 组件设置 android:exported=“false“ 属性 )
2023-06-13 09:18:01 时间
文章目录
一、报错信息
报错信息 : 点击应用图标后 , 应用并未启动 , 并弹出 " 未安装该应用 " 提示信息 ;
二、解决方案
排查了一下相关地方 , 发现是上午处理 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"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity
android: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"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity
android: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 混淆规则作用,Android代码混淆详解
- android中适配器的作用,适配器模式 在Android中的简单理解「建议收藏」
- android退出app代码,Android应用退出代码各种方式
- android 模拟器 haxm,Android模拟器不使用HAXM
- android定时器取消,Android定时器崩溃取消
- android应用程序_chrome Android
- android 拍照,图库,相册,上传
- 【Android 异步操作】Timer 定时器 ( Timer 与 TimerTask 基本使用 | Timer 定时器常用用法 | Timer 源码分析 )
- 【错误记录】Android 应用安装报错 ( The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER )
- 【错误记录】Flutter / Android 报错 ( AAPT: error: attribute android:requestLegacyExternalStorage not found )
- 【错误记录】Android 应用 release 打包报错处理 ( 关闭语法检查 | 日志处理 | release 配置 )
- 【错误记录】Android 分区存储 错误 ( 文件格式不匹配 )
- 【ijkplayer】编译 Android 版本的 ijkplayer ⑤ ( 执行 init-android-libyuv.sh | 执行 init-android-soundtouch.sh )
- 【错误记录】Android 应用导入 ijkplayer 报错 ( uses-sdk:minSdkVersion 19 cannot be smaller than version 21 decl )
- 【错误记录】Android 应用安全检测漏洞修复 ( StrandHogg 漏洞 | 设置 Activity 组件 android:taskAffinity=““ )
- 【Unity3D】Unity 中使用 C# 调用 Java ① ( Android Studio 模块准备 | 编译 Android 模块拿到字节码文件 | 拷贝字节码到 Unity 编辑器 )
- android 自定义Viewpager实现无限循环详解手机开发
- 安卓编年史(7):Android 1.1——第一个真正的增量更新