Android studio No executable code found 断点不可用

转载请标明出处:http://blog.csdn.net/xx326664162/article/details/50350601 文章出自:薛瑄的博客

你也可以查看我的其他同类文章,也会让你有一定的收货!

Android studio 设置了断点,但是开始调试后,看到的却是一个带×的断点

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.gradle中设置minifyEnabled 为false

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:

  1. If you are using Maven dependencies, go to Maven Projects -> refresh
  2. If that does not work, Try top menu –> Build –> Rebuild Project
  3. If that still doesn’t work, try top menu –> File –> Invalidate Cache/Restart
  4. 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 ,切换步骤请查看这里

关注我的公众号,轻松了解和学习更多技术
这里写图片描述

©️2020 CSDN 皮肤主题: 撸撸猫 设计师:设计师小姐姐 返回首页