반응형
안드로이드에서 크롬캐스트 연결 시 "전송 대상" 선택 후 앱 죽는 현상
디버깅을 해 보니 아래와 같은 에러 메시지가 보입니다.
java.lang.IllegalArgumentException: com.kiwidisk.android: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
at co m.google.android.gms.cast.framework.media.internal.zzm.zza(com.google.android.gms:play-services-cast-framework@@19.0.0:46)
at co m.google.android.gms.cast.framework.CastSession$zza.onResult(com.google.android.gms:play-services-cast-framework@@19.0.0:11)
at co m.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@17.1.0:11)
at android.os.Handler.dispatchMessage(Handler.java:106)
at co m.google.android.gms.internal.base.zar.dispatchMessage(com.google.android.gms:play-services-base@@17.1.0:8)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at co m.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at co m.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
문제는 크롬캐스트 버튼과 전송 대상 등 관련 화면은 모두 크롬캐스트에서 컨트롤합니다. 그래서 내가 FLAG_IMMUTABLE or FLAG_MUTABLE를 설정할 수 없었습니다.
내가 할 수 있는 건 크롬캐스트 라이브러리 버전을 높이는 방법 밖에 없었습니다.
<기존 크롬캐스트 버전>
implementation 'com.google.android.gms:play-services-cast-framework:19.0.0'
<신규 크롬캐스트 버전>
implementation 'com.google.android.gms:play-services-cast-framework:21.3.0'
크롬캐스트 라이브러리 버전을 바꾼 후 앱 종료 현상은 사라졌습니다.
반응형
'프로그램 개발해서 돈벌기 > Android' 카테고리의 다른 글
안드로이드에서 startService, startForegroundService 사용과 중복 실행 방지를 예제로 설명 (0) | 2023.12.08 |
---|---|
안드로이드 13 (Target SDK API 33) 이후부터 포그라운드 서비스 시작 시 자동으로 시작하던 알림(Local Notification)이 동작되지 않는 경우 해결 방법 (0) | 2023.09.20 |
[Java] 안드로이드 서비스에서 Local Notification 보내기 (0) | 2023.06.26 |
[Java] 안드로이드 Activity와 Forground Service에서 위치 값 가져오기 (0) | 2023.06.26 |
[Java] 안드로이드에서 싱글톤(Singleton) 클래스와 사용법 예제 (0) | 2023.06.26 |
댓글