gpt4 book ai didi

java - Android 启动时出错

转载 作者:行者123 更新时间:2023-12-01 11:20:42 26 4
gpt4 key购买 nike

我正在尝试在我的 Android 设备中运行我的应用程序,但不幸的是我不能。我的日志猫:

> Process: com.android.app.myapplication, PID: 15138
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.app.myapplication/com.android.app.myapplication.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
>
--->Caused by: java.lang.IllegalStateException: You need to use a
> Theme.AppCompat theme (or descendant) with this activity. at
> android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:122)
> at
> android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
> at
> android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
> at
> com.android.app.myapplication.MainActivity.onCreate(MainActivity.java:13)
> at android.app.Activity.performCreate(Activity.java:5248) at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
> at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
> at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
> at android.app.ActivityThread.access$800(ActivityThread.java:139) at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
> at android.os.Handler.dispatchMessage(Handler.java:102) at
> android.os.Looper.loop(Looper.java:136) at
> android.app.ActivityThread.main(ActivityThread.java:5086) at
> java.lang.reflect.Method.invokeNative(Native Method) at
> java.lang.reflect.Method.invoke(Method.java:515) at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at
> de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) at
> dalvik.system.NativeStart.main(Native Method)

我相信这与 list 、API、Gradle 脚本或其他东西有关,因为我的 Activity 和布局没有错误。

最佳答案

查看You need to use a Theme.AppCompat theme (or descendant) with this activity 。您的 Activity 可能正在扩展不正确的父类(super class)。

关于java - Android 启动时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31257545/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com