在Android Studio中调试测试用例

问题描述:

如何在Android Studio中调试JUnit测试用例?我放置了一个断点并使用了“调试测试用例”,但它只是运行代码并忽略了断点。在Android Studio中调试测试用例

更新: 这是我的build.gradle内容

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "com.****.mancala" 
    minSdkVersion 18 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    debug { 
     debuggable true 
    } 
} 
} 

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

为库项目的androidTest同样的事情。 Legit断点简单地被忽略。 – halxinate

确保您的build.gradle文件(一个与所有的依赖),你的调试版本类型中有debuggable true

也只是好措施确保其有效断点(不空行等)

+0

我把debuggable放在调试部分,但仍然无法正常工作。 – user3273345