断点没有击中Android Studio中 [英] Breakpoints not getting hit in Android Studio

查看:261
本文介绍了断点没有击中Android Studio中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Windows 7和最近从Eclipse中切换到Android工作室。我现在有麻烦的调试。

I'm using Windows 7 and have recently switched from Eclipse to Android Studio. I am now having trouble debugging.

运行Android的工作室0.8.6,我成立了一个完全默认安装的,我创建了一个默认为空的项目,针对ICS SDK,使用新项目向导。然后我把的onCreate断点,点击调试按钮运行。

Running Android Studio 0.8.6, I set up a completely default install, I create a default empty project, targeting the ICS SDK, using the new project wizard. I then put a breakpoint in onCreate, click on the debug button and run.

调试器连接,我可以看到消息连接到目标VM在调试器窗口。

The debugger attached as I can see the message "Connected to the target VM" in the debugger window.

我知道正在执行code,因为我更新了用户界面的一些文字显示这一点。

I know the code is being executed because I am updating some text in the UI to show this.

我试图把断点在很多地方,但没有被击中。​​

I have tried putting breakpoints in many places but none are hit.

我拉我的头发在这里,我只是不明白我在做什么错。我是新来的摇篮,所以我觉得有可能是在一些gradle这个设置,我应该改变,但肯定与向导生成一个绝对标准的项目应该让我打断点?

I'm pulling my hair out here as I just cannot see what I am doing wrong. I'm new to gradle so I think there may be some settings in gradle that I should be changing, but surely an absolutely standard project built with the wizard should let me hit breakpoints?

一件事我注意到的是,在我的build.gradle文件还有一个调试版本,只有释放没有提及。我想知道这可能是什么问题?

One thing I noticed is that in my build.gradle file there is no mention of a debug build, only a release. I wondered if that might be the problem?

buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

请注意。我已经从我自己的设备上尝试这样做,模拟器

Note. I have tried this on both my own device and the emulator

更新:

我在视图中的断点选项更改的设置,打开Java异常断点,但只针对未捕获的异常。然后,在的onCreate结束时,我故意造成一个NullPointerException异常。当我现在在调试运行,我还是不打我的实际code并没有看到我的源$ C ​​$ C突破,但程序不会暂停。我知道这是我的NullPointerException异常是造成这一点,因为当我删除它,我可以看到,code继续进行,不会中断。

I changed the settings in the View Breakpoints options to turn on "Java Exception Breakpoints" but only for uncaught exceptions. Then, at the end of onCreate I deliberately cause a NullPointerException. When I run in debug now, I still don't hit my actual code and don't see the code break on my source, but the program does pause. I know it is my NullPointerException that is causing this because when I remove it, I can see that the code continues and does not break.

在我的code打破了调试窗口点显示,我在主线程,在一个名为performLaunchActivity功能。我看不到任何比这更多的信息。 presumably因此,我通过code的任何级别的调试呼吁performLaunchActivity但我的源被视为如果我无法通过它一步呢?

At the point that my code breaks the debug window shows that I am in the "main" thread, in a function called "performLaunchActivity". I cannot see any more information than this. Presumably therefore I am debugging through whatever level of code is calling performLaunchActivity but that my source is being treated as if I can't step through it?

推荐答案

请确保你的JDK是最新的,你的系统只包含一个JDK。

Make sure your JDK is latest and your system contains only one JDK.

这篇关于断点没有击中Android Studio中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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