在创建第一个项目之前未找到Android活动类

时间:2014-08-22 15:46:51

标签: android android-activity android-studio

今天早上我下载了Android Studio。我有Java背景,我在PHP + Mysql + Jquery专业开发。我正在关注android开发人员教程,但是当我创建了第一个项目时(我猜它已经成为100%功能性的Hello World),并且设置了一个AVD模拟器。

但是当我运行新项目时,它会在下一个日志中抛出致命错误:

08-22 15:39:04.970      833-833/picacodigo.prueba3 D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
08-22 15:39:05.480      833-833/picacodigo.prueba3 D/AndroidRuntime﹕ Shutting down VM
08-22 15:39:05.480      833-833/picacodigo.prueba3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2abdd70)
08-22 15:39:05.500      833-833/picacodigo.prueba3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: picacodigo.prueba3, PID: 833
    java.lang.RuntimeException: Unable to start activity ComponentInfo{picacodigo.prueba3/picacodigo.prueba3.prueba3}: 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 picacodigo.prueba3.prueba3.onCreate(prueba3.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)

我没有编辑Android Studio创建的默认代码

1 个答案:

答案 0 :(得分:0)

将目标sdk版本更改为19

点击targetSdkVersion setting

不要将API等级20和平台4.4W用作Android虚拟设备。在AVD上设置Level 19和Platform 4.2.2,一切都按预期运行。