会话"app":错误启动活动 [英] Session 'app': Error Launching activity
问题描述
在gradle构建完成的Android Studio 2.0更新之后,我得到了:
会话"app":启动活动时出错.
它阻止了该应用程序启动,但已安装在我的模拟器中. 这是运行"选项卡中显示的内容:
执行时发生意外错误:am start -n"com.example.user.ypologismosmoriwn/com.example.user.ypologismosmoriwn.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER 启动活动时出错
这是代码:
package com.example.user.ypologismosmoriwn;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
这只是一个空的活动,什么也没添加
而XML代码只是具有4个文本和3个复选框的相对布局
感谢愿意帮助的人
更新到AS2.0后,我也遇到了这个问题.我发现这是因为启用了instant run
.因此,我的解决方案是禁用即时运行".而且有效.要禁用即时运行",可以转到Preference Dialog
(在Windows上可能是设置"对话框),然后选择Build, Execution, Deployment
> Instant Run
,然后取消选中所有复选框以禁用Instant Run
.
这是我的临时解决方案,可能会对您有所帮助.稍后,我将找到解决此问题的更好方法.
2016年6月6日更新
一个更好的解决方案,而不是禁用instant run
.
删除.idea
文件夹和.gradle
文件夹,然后单击按钮Sync Project with Gradle Files
(或通过菜单File
-> Sync Project with Gradle Files
),在此过程完成后,您可以正常运行应用程序.>
祝你好运〜
After the Android Studio 2.0 update while the gradle build finishes I get this :
Session 'app': Error Launching activity .
It prevents the app from starting but it's installed in my emulator. This is what comes up in the Run tab :
Unexpected error while executing: am start -n "com.example.user.ypologismosmoriwn/com.example.user.ypologismosmoriwn.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Error while Launching activity
Here is the code:
package com.example.user.ypologismosmoriwn;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
It's just an empty Activity,nothing added
and the XML code is just a Relative Layout with 4 Texts and 3 Check Boxes
This is the logcat i am getting
Thanks anyone who is willing to help
I also faced this issue after I updated to AS2.0. I found that it is because of the instant run
enabled. So my solution is to disable the "instant run". and it worked. To disable "instant run", you can go to Preference Dialog
( May be Setting dialog on Windows), then select Build, Execution, Deployment
> Instant Run
, and uncheck all the checkbox to disable Instant Run
.
This is my temporary solution and it may help you. Later, I'll find a better way to this issue.
update by 2016/06/06
A better solution instead of disabling instant run
.
Remove the .idea
folder and .gradle
folder, then click button Sync Project with Gradle Files
(or through the menu File
-> Sync Project with Gradle Files
), after this process finished, you are able to run your app as normal.
Good Luck~
这篇关于会话"app":错误启动活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!