1. 程式人生 > >Android studio No executable code found 斷點不可用

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

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    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

如果還想使用程式碼混淆,還想可以斷點除錯正常,可是參見這裡的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 ,切換步驟請檢視這裡

 

關注我的公眾號,輕鬆瞭解和學習更多技術
  這裡寫圖片描述

           

再分享一下我老師大神的人工智慧教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智慧的隊伍中來!https://blog.csdn.net/jiangjunshow