简体   繁体   English

Android Studio 2.2无法运行主屏幕项目

[英]Android Studio 2.2 cannot Run a homescreen project

I just updated my Android Studio to 2.2. 我刚刚将Android Studio更新为2.2。 And now I cannot RUN or DEBUG my old custom Homescreen project. 现在,我无法运行或调试旧的自定义主屏幕项目。 It always throws No Default Activity . 它总是抛出No Default Activity I can still built an APK and deploy it to either emulator or real device, but this thing never happened before. 我仍然可以构建一个APK并将其部署到仿真器或真实设备上,但这件事以前从未发生过。

My manifest for this homescreen project is like below 我对此主屏幕项目的清单如下

  <activity
        android:name=".activity.MainActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>
  </activity>

I have to change my manifest to something like below In order to make it RUN-ABLE from Android Studio, but my project is now become a non Homescreen app. 为了使其能够从Android Studio运行,我必须将清单更改为如下所示,但是我的项目现在变成了非主屏幕应用。

  <activity
        android:name=".activity.MainActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>
  </activity>

Please anybody who has this problem and managed to make it work? 请有这个问题并设法使之工作的人吗?

PS I use this tutorial as my reference in building a custom homescreen project PS:在构建自定义主屏幕项目时,我将教程用作参考

Is this Android Studio's bug???? 这是Android Studio的错误吗????

Thanks in advance. 提前致谢。

My log console is like below pic 我的日志控制台如下图所示

在此处输入图片说明

you just need to choose Specified Activity in Launch options inside Run/Debug Configuration! 您只需要在“运行/调试配置”内的“启动”选项中选择“指定活动”即可!

BR BR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM