targetSDK 31(Android 12)로 올렸더니 빌드 에러가?, Bumblebee
Search
🗼

targetSDK 31(Android 12)로 올렸더니 빌드 에러가?, Bumblebee

생성일
2022/04/20 06:30
태그
Android 12를 타겟으로 올릴 경우 Activity, Service, BroadcastReceiver, Provider 등에android:exported="true" 를 추가해줘야 한다.
하지만 다 추가해 주었음에도
경로\app\src\main\AndroidManifest.xml:27:9-33:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. 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. 경로\app\src\main\AndroidManifest.xml:34:9-40:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. 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. 경로\app\src\main\AndroidManifest.xml:41:9-47:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. 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.
Plain Text
복사
이런 에러가 발생한다. 해결 방법으로 찾은 것은
C:\Users\사용자명\.gradle\caches 폴더를 비워준 후 다시 빌드하는 것인데,
이렇게 하면 빌드는 성공 하지만 결국 같은 에러가 발생한다.
결정적인 해결 방법은 android나 kotlin 관련 라이브러리 업데이트로 안되었고,
app단 manifest에 다음 내용을 추가해줬다.
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity" android:theme="@android:style/Theme" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity> <activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity" android:theme="@android:style/Theme" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity> <activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity" android:theme="@android:style/Theme.Dialog" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>
XML
복사

참고