eclipse Android Studio - 在没有启动器活动的情况下运行应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16593234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:30:35  来源:igfitidea点击:

Android Studio - Run application without launcher activity

androideclipseandroid-studiodebuggingandroid-activity

提问by Lior Iluz

So like everyone else, I moved to Android Studio and encountered issues.

所以和其他人一样,我搬到了 Android Studio 并遇到了问题。

My current issue - Android Studio won't let me run an application without a launch-able activity in the Manifest, for example, my application Pro key which isn't suppose to be launch-able and runs great with Eclipse.

我当前的问题 - Android Studio 不允许我在 Manifest 中运行没有可启动活动的应用程序,例如,我的应用程序 Pro 密钥不应该是可启动的,并且在 Eclipse 中运行良好。

Obviously it's not suppose to run but is there any way to install it directly from Studio?

显然它不应该运行,但有没有办法直接从 Studio 安装它?

回答by nhaarman

In Run/Debug Configurations (just next to the launchbutton in the toolbar) you can manage your application configurations. There you should be able to specify whether you want to launch an Activityor not.

在运行/调试配置(就launch在工具栏中的按钮旁边)中,您可以管理您的应用程序配置。在那里您应该能够指定是否要启动Activity

回答by Ahmad Aghazadeh

In Run/Debug Configurations in General -> Launch Options -> Launch select Nothing like this
enter image description here

在常规中的运行/调试配置 -> 启动选项 -> 启动中选择没有这样的
在此处输入图片说明

回答by BryceCicada

For the case you mention, editing the 'Defaults' run configuration may not result in a runnable/installable app (at Android Studio 0.2.3, at least).

对于您提到的情况,编辑“默认”运行配置可能不会产生可运行/可安装的应用程序(至少在 Android Studio 0.2.3 中)。

Instead, it is possible to run/install by defining a new run configuration:

相反,可以通过定义新的运行配置来运行/安装:

Run -> Edit Configurations -> '+'

Select 'Do not launch Activity', but leave 'Deploy application' selected.

选择“不启动活动”,但选择“部署应用程序”。

回答by erluxman

Desired Android App Module> LaunchOptions> Launch-> Nothinginstead of (Activity)

所需的 Android 应用程序模块> LaunchOptions> Launch->没有instead of (Activity)