java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
概要
新しい個人プロジェクトを行うために.
私は新しいプロジェクトを作成し、Splashを作成し、それを構築しました.
上にエラーが発生しました.
2021-10-03 14:39:18.720 475-475/com.example.quickmemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.quickmemo, PID: 475
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:846)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:809)
at androidx.appcompat.app.AppCompatDelegateImpl.onPostCreate(AppCompatDelegateImpl.java:530)
at androidx.appcompat.app.AppCompatActivity.onPostCreate(AppCompatActivity.java:151)
at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1373)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3321)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
解決する
ログを見るとヒントが見つかります
You need to use a Theme.AppCompat theme (or descendant) with this activity.
だからテーマはxmlをチェックしましたが、異常はないようです...あ.
やばいナイトモード
style.xmlはトピックです.xmlから
明るいモードと暗いモードに分けられます.
splash用のstyleを暗いモードのトピックに設定します.xmlで定義すると、競合が発生したようです.
だからsplashstyleはlightモードのテーマですxmlに移行
AppCompatは親です.NoActionBar構築に変更後
正常に動作.
個人学習をベースに書いているからです.
情報が正しくない可能性があります.
知っていたら後で修正します
いつでもフィードバックを歓迎します.
読んでくれてありがとう.
Reference
この問題について(java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.), 我々は、より多くの情報をここで見つけました https://velog.io/@jeep_chief_14/java.lang.IllegalStateException-You-need-to-use-a-Theme.AppCompat-theme-or-descendant-with-this-activityテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol