반응형
이번 포스팅은 Android Build 오류에 대하여 알아보도록 하겠습니다.
< Error >
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
< Solution >
1. AppCompat 테마를 사용해야 합니다.
2. AlertDialog. Builder로 Instance를 생성 시 AppCompat Library가 적용된 테마를 호출하여 build를 합니다.
(declaration)
val builder = AlertDialog.Builder(ContextThemeWrapper(MainActivity@this , R.style.AppTheme))
(style.xml)
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowNoTitle">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
반응형
'Dev & Tech > Android & iOS' 카테고리의 다른 글
| [Error] entries cannot be protected with passwords (0) | 2019.08.27 |
|---|---|
| [Error] Unable to add window -- token null is not valid; is your activity running? (0) | 2019.08.26 |
| [Error] Execution failed for task ':app:transformClassesWithInstantRunForDebug'. (0) | 2019.08.26 |
| [Android] Android FileProvider 파일 공유 방법 (0) | 2019.08.26 |
| [Android] AndroidX로 마이그레이션 해야 하는 이유와 방법 (0) | 2019.01.31 |