반응형
이번 포스팅은 Android Build 오류에 대하여 알아보도록 하겠습니다.
< Error >
Unable to add window -- token null is not valid; is your activity running?
< Solution >
1. Dialog 생성 시 applicationContext를 사용하여 발생하는 오류로 특정 Activity 의 Context를 호출하여 build 하시면 됩니다.
(Before)
val builder = AlertDialog.Builder(ContextThemeWrapper(applicationContext , R.style.AppTheme))
(After)
val builder = AlertDialog.Builder(ContextThemeWrapper(MainActivity@this , R.style.AppTheme))
반응형
'Dev & Tech > Android & iOS' 카테고리의 다른 글
| [Error] exposed beyond app through ClipData.Item.getUri() (0) | 2019.08.27 |
|---|---|
| [Error] entries cannot be protected with passwords (0) | 2019.08.27 |
| [Error] You need to use a Theme.AppCompat theme (or descendant) with this activity. (0) | 2019.08.26 |
| [Error] Execution failed for task ':app:transformClassesWithInstantRunForDebug'. (0) | 2019.08.26 |
| [Android] Android FileProvider 파일 공유 방법 (0) | 2019.08.26 |