You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 12+安装失败:未设置android:exported属性问题求助

上传应用集时遭遇Android 12+兼容性错误

您上传的APK或Android App Bundle中存在带有intent filter的activity、object alias、service或broadcast receiver,但未设置android:exported属性。该文件无法在运行Android 12或更高版本的设备上安装。

我的AndroidManifest.xml内容:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gallery.photosgallery.videogallery.google">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>


<application
    android:name="com.gallery.photosgallery.videogallery.google.App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:exported="true"
    android:hardwareAccelerated="false"
    android:requestLegacyExternalStorage="true"
    android:preserveLegacyExternalStorage="true"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.Gallery3">
    <activity 
android:name="com.gallery.photosgallery.videogallery.google.Activity.ViewVideoActivity"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar" />
    <activity
 android:name="com.gallery.photosgallery.videogallery.google.Activity.ViewVideoAlbumActivity"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar" />

    <activity
        android:name="com.gallery.photosgallery.videogallery.google.Activity.EditActivity"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar" />
    <activity
 android:name="com.gallery.photosgallery.videogallery.google.Activity.ViewImageActivity"
        android:exported="true"
        android:hardwareAccelerated="false"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar" />
    <activity
android:name="com.gallery.photosgallery.videogallery.google.Activity.ViewAlbumActivity"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar" />

    <service android:name="com.gallery.photosgallery.videogallery.google.Service.GetFileList"
        android:exported="true"
        />

    <activity
        android:name="com.gallery.photosgallery.videogallery.google.Activity.MainActivity"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Gallery3.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths" />
    </provider>

    <activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
        android:exported="true"
        />

    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="@string/app_id"/>
</application>

</manifest>

解决办法

  • 查看合并后的清单文件:打开Android Studio中的AndroidManifest.xml,切换到底部的「Merged Manifest」标签,查看项目所有组件(包括依赖库的)的最终合并结果。
  • 排查带<intent-filter>的组件:逐一检查每个activity、service、broadcast receiver,只要组件包含<intent-filter>,必须显式设置android:exported属性(true表示允许外部调用,false仅限内部使用)。
  • 处理依赖库组件:如果发现第三方库中的组件未设置android:exported,可在自己的AndroidManifest.xml中重新声明该组件并添加android:exported属性,覆盖库中的配置。

内容的提问来源于stack exchange,提问作者EugeneSermyagin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 23:18:33