티스토리 뷰
Android
[오류수정] The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
작은성공 2019. 11. 17. 06:23728x90
반응형
Android material 1.1.0에서 추가된 기능을 사용하고 싶었다.
그래서, 1.0.0 라이브러리를 1.1.0으로 변경한 뒤 빌드를 하니 아래와 같은 메시지가 떴다.
2019-11-17 06:10:56.975 12646-12646/com.example.xxxx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.xxxx, PID: 12646
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xxxx/com.example.xxxx.views.MainActivity}: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class com.google.android.material.textfield.TextInputLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2857)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2935)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1627)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:6724)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
Caused by: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
at com.example.xxxx.views.login.LoginFragment.onCreateView(LoginFragment.kt:33)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2624)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:904)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
2019-11-17 06:10:56.979 12646-12646/com.example.xxxx E/AndroidRuntime: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1335)
at android.app.Activity.performStart(Activity.java:7048)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2820)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2935)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1627)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:6724)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:248)
at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:222)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:150)
at com.google.android.material.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:120)
at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:424)
at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:396)
... 43 more
1.1.0으로 migration 할 때 주의할 점에 대한 글을 찾아봤는데, 못 찾았다.
결국 위 로그에서 가장 중요한 것은
The style on this component requires your app theme to be Theme.MaterialComponents
위 로그였다.
아래 글에 보면 Change your app theme to inherit from a Material Components theme 라고 적혀 있다.
https://material.io/develop/android/docs/getting-started/
그래서, 앱 테마 상속을 AppCompat에서 받던것을, MaterialComponents에서 받게 했다.
before
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
After
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
위와 같이 수정하니 정상 동작 했다.
728x90
반응형
'Android' 카테고리의 다른 글
댓글
반응형
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Android
- 자마린
- target version 31
- 유튜버 영세율
- Droid Knights
- Xamarin
- bundletool
- 플루터
- 영세율 채널이름
- 앱개발자 영세율
- Flutter
- 안드로이드 스튜디오 범블비
- 영세율 채널주소
- Android Studio bumblebee
- 31 업데이트 후 오류
- gmail 이슈
- Account.b
- 드로이드 나이츠
- Windows SDK version 8.1
- ListView
- aab qa
- 범블비 번역
- 안드로이드 스타일
- 내부 앱 공유
- 안드로이드 테마
- 블로거 영세율
- aab 테스트
- 안드로이드
- 안드로이드 P
- cleartext
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
글 보관함