I tried to debug a release version of my Android application but Android Studio failed to attach a debugger. (It could not find Android procces of my running application).
Make sure your build variant is set to "debug". And debug has debuggable true
on your build.gradle file
Check if Tools->Android->Enable ADB Integration
is enabled.
Also disable and re-enabling it works most of the times.
Believe it or not,a faulty USB cable can cause this problem to linger even if you follow all the suggestions here.Changing my USB cord did it for me
The solution is to turn on debuggable flag (debuggable true
) in application's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.example"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
debuggable true
}
}
}
After Android Studio synced Gradle with project files and reinstalled an application, the debugging start working.
Click the green bug, but make sure the drop down is set to app, if not it will not deploy your app, and just say something about.
Connected to the target VM, address: 'localhost:xxx', transport: 'socket'
You also should have Tools->Android->Enable ADB Integration active.