简体   繁体   中英

Android studio 2.1.2 does not debug a program at Android device

I use:

Windows 7 64 bit, 
Android Studio 2.1.2
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode).

My app works fine on my mobile and on Android Emulator. However when I tried to run debug mode on my Android phone nothing happened. I made several breakpoints where the program has to stopb but it ignores my breakpoints. Please help me, if I need to provide additional information let me know.

My build.gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.example.android.justjava"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

I recommend you to try like this:

  1. Select debug Build Flavor.
    在此处输入图片说明

  2. Set break point at the code always execute.
    ex) Activity's onCreate method.
    在此处输入图片说明

  3. Run as Debug. (Select Menu -> Run -> Debug in AndroidStudio)

  4. Execution will be stopped at the break point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM