2017-04-24 98 views
1

我需要兩個測試文件夾中的JUnit。所以我添加無法添加JUnit來測試和androidTest

androidTestCompile 'junit:junit:4.12' 
testCompile 'junit:junit:4.12' 

但只要我添加的JUnit到androidTest我無法運行測試,因爲扔in this log.

就如何解決這個問題的任何想法錯誤的?

編輯:我從運行配置中刪除了識別gradle的版本。現在它說,我TestSuite是空的,但也有在你的build.gradle文件,@Test

回答

1

哈瓦與此一試註釋

dependencies { 

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 

    testCompile 'junit:junit:4.12' 

} 
+0

所以咖啡包括JUnit測試? – 4ndro1d

+0

幾乎相同的堆棧跟蹤 – 4ndro1d

+0

我不知道。它由android studio自動創建。並解決我的Junit測試問題。 – Cyrus