急……这个是什么意思啊?怎么处理啊?
2023-01-01 12:45:53.216 3857-3857/com.example.one E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.one, PID: 3857
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.one/com.example.one.ManageActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2668)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6176)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:852)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:815)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:703)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.example.one.ManageActivity.onCreate(ManageActivity.java:112)
at android.app.Activity.performCreate(Activity.java:6692)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6176)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
这个错误信息表明在应用程序中有一个 Activity 的主题使用了一个不是 Theme.AppCompat 的主题,而且这个主题必须使用 Theme.AppCompat 或者它的子主题。
可以试试以下解决方案:
1、在 AndroidManifest.xml 中,将该 Activity 的主题设置为 Theme.AppCompat 或者它的子主题。
2、如果应用程序使用了 AppCompat 库,可以在 styles.xml 中定义一个 AppCompat 主题,然后将该 Activity 的主题设置为这个主题。
例如可以在 styles.xml 中添加以下内容:
<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
然后在 AndroidManifest.xml 中,将该 Activity 的主题设置为 MyAppTheme:
<activity android:name=".MyActivity" android:theme="@style/MyAppTheme">
3、如果应用程序不使用 AppCompat 库,可以使用系统主题 android:Theme.Material 或者它的子主题。
仅供参考,望采纳,谢谢。
夜神模拟器的内核版本太低了
你用的最新版本的AS,那么默认的SDK版本很高 33应该是
建议你最好用真机或者 AS自带的AVD调试