运行默认的hello app Gradle和API

时间:2014-09-15 23:40:53

标签: android

刚下载Android工作室并遇到一些麻烦。无法运行默认的hello world程序。 似乎与API版本号和正确的链接有关? 我最初的版本是20,不适用于手机。我试图改为第19版

启动 - 计算机 - 属性高级系统设置 - 环境变量读取: java_home C:程序文件/ javajdk1.8.0_20 (我也可能偶然改变了一些事情:           ComSpec c:windows / system32 / cmd32)

从那里我从Android工作室下载了一些:

       SDK manager"

按API排序 我拥有19的所有API 由于某种原因玻璃开发预览没有安装。 我也有API 20的一些东西 和usb驱动程序和存储库(rev 6) google play rev 19 google usb driver rev 10

RUN 当我点击运行...我选择nexus 7(那里唯一一个) 手机屏幕打开,然后在加载时读取Android

等待设备。记录....

          "C:...\AppData\Local\Android\android-studio1\sdk\tools\emulator.exe" -avd nexus7             -netspeed full -netdelay none
       Device connected: emulator-5554
       Device nexus7 [emulator-5554] is online, waiting for processes to start up..
       Device nexus7 [emulator-5554] is online, waiting for processes to start up..
       Device nexus7 [emulator-5554] is online, waiting for processes to start up..
       Device nexus7 [emulator-5554] is online, waiting for processes to start up..
       Device nexus7 [emulator-5554] is online, waiting for processes to start up..

___________手机开始工作时间右上方没有文字________

         Device nexus7 [emulator-5554] is online, waiting for processes to start up..
         Device nexus7 [emulator-5554] is online, waiting for processes to start up..
         Device nexus7 [emulator-5554] is online, waiting for processes to start up..
         Device nexus7 [emulator-5554] is online, waiting for processes to start up..

屏幕变暗,然后当我"滑动" 我重新运行它并选择open nexus 7

设备nexus7

e"log cat log reads....
      09-15 22:56:52.200      777-777/com.example.******.myapplication D/AndroidRuntime﹕            Shutting down VM
      09-15 22:56:52.200      777-777/com.example.******.myapplication W/dalvikvm﹕ threadid=1:    thread exiting with uncaught exception (group=0xb3a81d70)
        09-15 22:56:52.230      777-777/com.example.******.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.******.myapplication, PID: 777
java.lang.RuntimeException: Unable to start activity                                         ComponentInfo{com.example.******.myapplication/com.example.******.myapplication.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 com.example.******.myapplication.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)

ë

对不起我对这一切都很新,不知道发布什么。我没有触及任何默认的代码。

2 个答案:

答案 0 :(得分:0)

这似乎是错误的已知问题"您无法结合滑动解雇和操作栏。"

它告诉我们:

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

更改AVD目标

打开AVD Manager 工具 - > Android-> AVD Manager。

enter image description here

答案 1 :(得分:0)

通过Chk0nDanger更改上述值后 然后我做了另一张海报发现的以下内容.. 这似乎解决了这个问题。

谢谢你们!

我有同样的问题。但是sdk版本不是造成这种例外的原因。

在AndroidManifest.xml文件中,主题中包含ActionBar。

android:theme =“@ style / AppTheme”>

将以上行更改为

android:theme =“@ android:style / Theme.DeviceDefault”>

这将修复异常。