at com.example.helloandroid.MainActivity.onCreate(MainActivity.java:14)看看MainActivity类的第14行代码,有没有问题...
log里告诉你原因了 Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. 具体在下面: at com.example.helloandroid.MainActivity.onCreate(MainActivity.java:14)
07-23 09:30:51.306: E/AndroidRuntime(1752): FATAL EXCEPTION: main 07-23 09:30:51.306: E/AndroidRuntime(1752): Process: com.android.criminallnetent, PID: 1752 07-23 09:30:51.306: E/AndroidRuntime(1752): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.criminallnetent/com.android.criminallnetent.CrimeListActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. ----------------------------------------------------------------------------------------------- try changing target sdk version to 19 check here targetSdkVersion setting Do not use API Level of 20 and Platform 4.4W, as Android Virtual Device. With Level 19 and Platform 4.2.2 set on AVD everything runs as it should. <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
你好,我查看了一下,你所讲的xml应该是Manifest.xml中的android:name吧,是跟activity类名一样的,都是android:name=".MainActivity"
Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
具体在下面:
at com.example.helloandroid.MainActivity.onCreate(MainActivity.java:14)
12 protected void onCreate(Bundle savedInstanceState) {
13 super.onCreate(savedInstanceState);
14 setContentView(R.layout.activity_main);
15 TextView tv=new TextView(this);
16 tv.setText("Hello World");
17 setContentView(tv);
18 }
07-23 09:30:51.306: E/AndroidRuntime(1752): Process: com.android.criminallnetent, PID: 1752
07-23 09:30:51.306: E/AndroidRuntime(1752): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.criminallnetent/com.android.criminallnetent.CrimeListActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
-----------------------------------------------------------------------------------------------
try changing target sdk version to 19
check here targetSdkVersion setting
Do not use API Level of 20 and Platform 4.4W, as Android Virtual Device. With Level 19 and Platform 4.2.2 set on AVD everything runs as it should. <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
恩,今天我google了一下, 发现也有人有类似的问题,卸载api 20更换成19的就没有问题了,多谢大家。
更改 styles.xml 文件:
<style name="AppTheme" parent="android:Theme.DeviceDefault">