본문 바로가기
안드로이드

[Android] android:exported 스토어 업로드 에러 해결

by 코딩히어로 2022. 9. 14.
728x90

1


Android 12 이상에서 구글스토어에 App Bundle을 출시하기 위해서 업로드를 했지만

다음과 같은 에러가 발생하여 원인을 찾아보았습니다

인텐트 필터를 포함하되 'android:exported' 속성을 설정하지 않고 활동, 활동 별칭, 서비스 또는 broadcast receiver가 있는 APK 또는 Android App Bundle을 업로드했습니다. Android 12 이상에는 이 파일을 설치할 수 없습니다. 참조: developer.android.com/about/versions/12/behavior-changes-12#exported

해당 문구에서 알 수 있듯이 인텐트 필터를 사용하고 있지만 android:exported 속성을 설정하지

않았기 때문에 업로드가 불가능하다는 말인데 Android 12 이상에서는 인텐트 필터를 사용하기 위해서는

반드시 android:exported 속성에 대한 정의를 해 주어야 사용이 가능합니다

<activity
    android:name="com.teang.test.main"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:exported="true"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

위 코드에서 처럼 intent-filter가 있는 activity 구문에

android:exported 속성을 정의해주면 됩니다

android:exported를 true로 설정하면 외부앱 액세스를 허용하겠다는 의미이고

false로 설정하면 외부앱 액세스를 허용하지 않겠다는 의미입니다

 

만약 이렇게 activity에 exported 설정을 해주었음에도 같은 에러가 발생한다면

activity 외에 구현한 service단이 있는지 확인해야 합니다

<receiver android:name="com.teang.mykey_mobility.AppWidget"
    android:exported="false">
    <meta-data
        android:name="android.appwidget.provider"
        android:resource="@xml/widget" />
    <intent-filter>
        <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
        <action android:name="com.teang.test.ENGINESTART" />
        <action android:name="com.teang.test.ENGINESTOP" />
        <action android:name="com.teang.test.DOORLOCK" />
        <action android:name="com.teang.test.DOORUNLOCK" />
        <action android:name="android.intent.action.SCREEN_ON" />
    </intent-filter>
</receiver>

제 경우에는 receiver단을 activity 외에 구현하였기 때문에 receiver에도

android:exported 설정을 해 줌으로써 문제를 해결했습니다

728x90
반응형

댓글