会话“应用程序":启动活动时出错 [英] Session 'app': Error Launching activity

查看:35
本文介绍了会话“应用程序":启动活动时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio 2.0 更新后,gradle 构建完成,我得到了这个:

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 :

执行时出现意外错误:am start -n "com.example.user.ypologismosmoriwn/com.example.user.ypologismosmoriwn.MainActivity";-a android.intent.action.MAIN -c android.intent.category.LAUNCHER启动活动时出错

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

代码如下:

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);
    }
}

这只是一个空的Activity,没有添加任何东西

It's just an empty Activity,nothing added

XML 代码只是一个具有 4 个文本和 3 个复选框的相对布局

and the XML code is just a Relative Layout with 4 Texts and 3 Check Boxes

这是我得到的日志

感谢任何愿意提供帮助的人

Thanks anyone who is willing to help

推荐答案

我更新到 AS2.0 后也遇到了这个问题.我发现这是因为启用了 instant run.所以我的解决方案是禁用即时运行".它奏效了.要禁用即时运行",您可以转到Preference Dialog(Windows 上可能是设置对话框),然后选择Build, Execution, Deployment > Instant Run,并取消选中所有复选框以禁用 Instant Run.

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.

一个更好的解决方案,而不是禁用即时运行.删除.idea文件夹和.gradle文件夹,然后点击按钮Sync Project with Gradle Files(或通过菜单Filecode> -> Sync Project with Gradle Files),此过程完成后,您就可以正常运行您的应用了.

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.

祝你好运~

这篇关于会话“应用程序":启动活动时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆