我知道之前曾经问过这样的问题,我一直在筛选它们。所以这是我的情况:我有很多使用Java的经验,特别是Eclipse。我只是尝试运行我的hello world应用程序而不做任何修改。虽然模拟器正常启动但它无法启动.logcat显示以下错误:
07-04 17:40:07.430: E/AndroidRuntime(862): FATAL EXCEPTION: main
07-04 17:40:07.430: E/AndroidRuntime(862): Process: com.trial.first, PID: 862
07-04 17:40:07.430: E/AndroidRuntime(862): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.trial.first/com.trial.first.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread.access$800(ActivityThread.java:138)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.os.Handler.dispatchMessage(Handler.java:102)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.os.Looper.loop(Looper.java:136)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread.main(ActivityThread.java:5026)
07-04 17:40:07.430: E/AndroidRuntime(862): at java.lang.reflect.Method.invokeNative(Native Method)
07-04 17:40:07.430: E/AndroidRuntime(862): at java.lang.reflect.Method.invoke(Method.java:515)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
07-04 17:40:07.430: E/AndroidRuntime(862): at dalvik.system.NativeStart.main(Native Method)
07-04 17:40:07.430: E/AndroidRuntime(862): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.Activity.setContentView(Activity.java:1930)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
07-04 17:40:07.430: E/AndroidRuntime(862): at com.trial.first.MainActivity.onCreate(MainActivity.java:14)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.Activity.performCreate(Activity.java:5242)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-04 17:40:07.430: E/AndroidRuntime(862): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
07-04 17:40:07.430: E/AndroidRuntime(862): ... 11 more
07-04 17:40:11.080: I/Process(862): Sending signal. PID: 862 SIG: 9
清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trial.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".TestActivity"
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>
答案 0 :(得分:0)
使用API级别为19的Android虚拟设备
在你的Manifest.xml中
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" /
将android:targetSdkVesion
更改为19