gpt4 book ai didi

Android应用程序总是崩溃

转载 作者:行者123 更新时间:2023-12-03 16:53:10 24 4
gpt4 key购买 nike

我是android编程新手,所以我开始关注互联网上的教程,非常简单的东西,但是当我编译它以便在模拟器上运行时,它总是在我的设备模拟器上说:“不幸的是你的程序已经停止” (nexus 4)所以我认为我的java代码有错误。

所以我创建了一个全新的项目,没有使用通常的“hello world”进行修改,所以它应该可以工作,但是当我要运行它时,它看起来是一样的。 “不幸的是,您的程序已停止”。
这是我的控制台上显示的内容。

也许它与我正在使用的 API 版本有关?

07-04 11:28:35.120      738-738/example.com.teste W/dalvikvm﹕ threadid=1: thread     exiting with uncaught exception (group=0xb2a55d70)
07-04 11:28:35.140 738-738/example.com.teste E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: example.com.teste, PID: 738
java.lang.RuntimeException: Unable to start activity ComponentInfo{example.com.teste/example.com.teste.MyActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5026)
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:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
at android.app.Activity.setContentView(Activity.java:1930)
at example.com.teste.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5242)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
            at android.app.ActivityThread.access$800(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5026)
            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:777)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
            at dalvik.system.NativeStart.main(Native Method)
07-04 11:28:56.080 738-738/example.com.teste I/Process﹕ Sending signal. PID: 738 SIG: 9

list 文件更新:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.com.teste" >

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

使用 targetSdkVersion 作为 19。

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19" />

There is a problem with API 20

Reference

希望能帮助到你。

关于Android应用程序总是崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24573477/

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