인프런 커뮤니티 질문&답변

Si Choi님의 프로필 이미지

작성한 질문수

배달앱 클론코딩 [with React Native]

[안드로이드] 푸시 노티 설정 시 "android:exported needs to be explicitly specified" 에러 해결 방법

해결된 질문

작성

·

1.9K

3

ㅁ 에러 문구 

Manifest merger failed : android:exported needs to be explicitly specified for element <receiver#com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver>. 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

아마 제가 중간에 문서를 참조하면서 놓친 부분인 것 같습니다.

 

ㅁ 원인 

안드로이드 12를 타게팅 하는 경우, AndroidManifest.xml 파일에서 activities, services, receivers 등에 android:exported를 설정해야 함

(https://ddolcat.tistory.com/1065)

 

ㅁ 해결책 

activities, receivers등에 android:exported를 설정하면 됩니다.

참조 차 제 AndroidManifest.xml 공유합니다. 

<application
      android:usesCleartextTraffic="true"
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <meta-data
        android:name="com.naver.maps.map.CLIENT_ID"
        android:value="71l7g40qjh" />
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="true"/>
        <!-- Change the resource name to your App's accent color - or any other color you want -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" android:exported="true" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" android:exported="true" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
            </intent-filter>
        </receiver>

        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
    </application>

답변 1

2

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

항상 공유해주셔서 감사합니다.

Si Choi님의 프로필 이미지

작성한 질문수

질문하기