15

I connect the debugger to my emulator and the idea console say :

Connected to the target VM, address: localhost:8612,transport:`socket` 

But when i want to test my app it doesnt stop in Break points ! See this screen shot :

enter image description here

And this :

enter image description here

I test it with emulator and physical device and also rebuild project and also restart idea ! but doesn't work.

YFeizi
  • 1,498
  • 3
  • 28
  • 50
  • Could you please tell the interface name which has method onListItemSelected(long itemId) ? – Sushant Feb 26 '15 at 16:06
  • Please post the code where you called _onListItemSelected(itemId); _ – Sushant Feb 26 '15 at 17:05
  • Is the screenshot code from an external dependency of your project? If yes may the dependency source and compiled code be out of sync? – ARNeto Feb 27 '15 at 02:15
  • 1
    no ! its my code ! Im not sure where is the problem, itried with both intelij idea 13 and 14 and also with different porject ! but doesnt work :/ – YFeizi Feb 27 '15 at 08:58
  • @y.feizi Is this method in any library or is this your projects code itself? Library in the sense, whether you are using lib created by you or added in libs folder or synced with gradle ? – Sreehari Jul 07 '16 at 06:45
  • @y.feizi Try to put break point on the if statement and in else . See if it is encountering the break point or skipping it? – Sreehari Jul 07 '16 at 06:47

5 Answers5

6

First, make sure your IntellJ IDEA instance is up to date, there have been a couple of recent bugfixes related to this. (Ex: https://youtrack.jetbrains.com/issue/IDEA-81769)

Otherwise:

If android:process is set this may be your issue: https://youtrack.jetbrains.com/issue/IDEA-64456

Else you might have the problem described here: https://youtrack.jetbrains.com/issue/IDEA-95721

Unfortunately this second link lacks any sort of concrete help from the IntellJ team yet. One workaround is to use Eclipse for debugging temporarily, although that's a kinda awful solution.

Others
  • 2,876
  • 2
  • 30
  • 52
3

Read these similar questions

Can't reach some lines debugging android app

Cannot set Java breakpoint in Intellij IDEA

All your breakpoints can't works

it may be cause by code shrinking in your build gradle file, you can find it build.gradle(APP Name) in your project root directory. Make sure the minifyEnable under buildType is set to false.

buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt')
    }
    debug {
        debuggable true
        minifyEnabled false // set this to false
        proguardFiles getDefaultProguardFile('proguard-android.txt')
    }
}

Some breakpoints can work, but some could not

Follow the 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
Community
  • 1
  • 1
Harlan
  • 847
  • 5
  • 15
2

set the breakpoint on

your_view.setOnListItemSelectedListener();

and on if(...) in OnListItemSelected

dvs
  • 644
  • 5
  • 14
2

Did you by any chance activated ProGuard for your build? Try to turn it off. It may destroy your Breakpoints.

Also try:

  • Build -> Clean Build
  • File -> Invalidate Caches / Restart
dipdipdip
  • 2,326
  • 1
  • 21
  • 31
1

There're message "Suspend all" in info about breakpoint, it means that IDE will skip all breakpoints, you need to turn it off (usually somewhere in debugging window there is a button to suspend breakpoints)

Or maybe it's build type. Did you check your build, is it debug?

Wackaloon
  • 2,285
  • 1
  • 16
  • 33