如果有人可以幫助我這個。我下載了AndroidSDK以及android編程所需的其他東西,並且我遇到了一些問題(有趣的說)hello world。targetSdkVersion設置
我只是沒有得到與AppManifest tarketSdkVersion設置的東西。每當它沒有被設置爲「13」(只注意到8這是我的minSdkVersion也在努力)的應用程序有「不幸的是應用程序停止工作」在logcat的屏幕,這樣的:
07-01 01:26:47.820: E/AndroidRuntime(902): FATAL EXCEPTION: main
07-01 01:26:47.820: E/AndroidRuntime(902): Process: pl.bbZoftware.eclipsestandalone, PID: 902
07-01 01:26:47.820: E/AndroidRuntime(902): java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.bbZoftware.eclipsestandalone/pl.bbZoftware.eclipsestandalone.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.access$800(ActivityThread.java:138)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.os.Handler.dispatchMessage(Handler.java:102)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.os.Looper.loop(Looper.java:136)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.main(ActivityThread.java:5026)
07-01 01:26:47.820: E/AndroidRuntime(902): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 01:26:47.820: E/AndroidRuntime(902): at java.lang.reflect.Method.invoke(Method.java:515)
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
07-01 01:26:47.820: E/AndroidRuntime(902): at dalvik.system.NativeStart.main(Native Method)
07-01 01:26:47.820: E/AndroidRuntime(902): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Activity.setContentView(Activity.java:1930)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
07-01 01:26:47.820: E/AndroidRuntime(902): at pl.bbZoftware.eclipsestandalone.MainActivity.onCreate(MainActivity.java:14)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Activity.performCreate(Activity.java:5242)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
07-01 01:26:47.820: E/AndroidRuntime(902): ... 11 more
07-01 01:26:55.340: I/Process(902): Sending signal. PID: 902 SIG: 9
我不明白這是不是故意的,我收到了一些SDK錯誤或其他的東西。 我是谷歌搜索的答案,但coulnt找到任何。告訴我是否應該從項目中添加更多信息,尋找答案。
編輯:忘了補充,我有一個4.4.2 KitKat的Android設備,所以我想讓項目目標設置爲20.這就是我如何注意到這個錯誤。
EDIT2:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
activity_main.xml中:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="pl.bbZoftware.eclipsestandalone.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
</RelativeLayout>
EDIT3:
清單文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pl.bbZoftware.eclipsestandalone"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="13" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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>
請張貼代碼'onCreate'你'MainActivity'類。當您調用'setContentView'時,還會發布您使用的佈局的XML。重要信息是堆棧跟蹤中最後一條「引發」行中的消息:「您不能將滑動解除和動作欄組合在一起」。 –
我注意到這個消息,只是不知道該怎麼做。這是乾淨的項目,除了targetSdkVersion之外,我沒有改變任何東西。 – bbZ
也許問題不在於代碼,而在於AVD?有我的設置:[截圖](http://puu.sh/9RyU6/b90bf52633.png) – bbZ