앱 만들기/안드로이드

android:exported 에러 수정하기

나도 처음이야 2022. 1. 28.

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

에러가 발생할때 수정 방법입니다.

 

Manifest 파일에 android:exported="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>

그 이유는 안드로이드12(API 31) 부터는 해당 설정을 직접해주어야 한다는 군요.

참고로 android:exported="false"로 처리하면 에러는 발생하지 않으나 앱이 실행되지 않습니다.

하기는 안드로이드 개발자 페이지 내용입니다.

 

+++

android:exported이 요소는 다른 애플리케이션의 구성요소로 액티비티를 시작할 수 있는지 설정합니다. 할 수 있으면 "true", 할 수 없으면 "false"입니다. "false"인 경우, 해당 액티비티는 같은 애플리케이션의 구성요소 또는 사용자 ID가 같은 애플리케이션으로만 시작할 수 있습니다.

자세한 내용은 하기 내용을 참고드립니다. 감사합니다.

 

https://developer.android.com/guide/topics/manifest/activity-element#exported

 

<액티비티>  |  Android 개발자  |  Android Developers

Declares an activity (an Activity subclass) that implements part of the application's visual user interface. All activities must be represented by {@code } elements in the manifest file. Any that are not declared there will not be seen by the system…

developer.android.com

 

반응형

댓글