您的位置:首页 > 移动开发 > Android开发

Android studio No executable code found 断点不可用

2015-12-18 11:36 204 查看
Android studio 设置了断点,但是开始调试后,看到的却是一个带×的断点

[code]Warning: No executable code found at line 482 in class com.xx.xx.


1、所有的断点都是带×的

参考:http://stackoverflow.com/questions/21743442/cant-reach-some-lines-debugging-android-app

http://stackoverflow.com/questions/20097709/android-studio-omits-breakpoints

http://stackoverflow.com/questions/28836243/android-studios-debugger-not-stopping-at-breakpoints-within-library-modules

在module的build.gradlevs 设置minifyEnabled false

[code]buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt')
        signingConfig signingConfigs.release
    }
    debug {
        debuggable true
        minifyEnabled false //这是关键的,我的问题就是出在这里
        proguardFiles getDefaultProguardFile('proguard-android.txt')
        signingConfig signingConfigs.release
    }
}


如果还想使用代码混淆,还想可以断点调试正常,可是参见这里的smoothumut的回答,博主未验证是否可行

2、若只是个别地方,显示带×的断点

参考:http://stackoverflow.com/questions/11591662/cannot-set-java-breakpoint-in-intellij-idea

http://blog.csdn.net/lihenair/article/details/48975269

I had similar problems and various attempts has been applied. Below is my usual steps:

If you are using Maven dependencies, go to Maven Projects -> refresh

If that does not work, Try top menu –> Build –> Rebuild Project

If that still doesn’t work, try top menu –> File –> Invalidate Cache/Restart

If that still doesn’t work, then $CATALINA_BASE/bin/catalina.sh stop, then start

After this, usually it covers 99% of the problems. Otherwise, Probably you will have to examine some other possibilities.

2和3两个步骤可以解决问题,若不行再尝试全部步骤

3、真机调试,第一个断点正常,第2个断点显示带×

参考:http://stackoverflow.com/questions/20097709/android-studio-omits-breakpoints

http://stackoverflow.com/questions/20179748/the-first-line-breakpoint-works-only/20203066#20203066

切换ART为Dalvik ,切换步骤请查看这里
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: