2016-01-21 42 views
0

我有從eclipse導入的Android工作室投影。我已經開始爲這個項目進行單元測試。這裏是添加的依賴關係,排除junit從構建apk的Android工作室

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    // Unit testing dependencies 
    compile 'junit:junit:4.12' 
    // Set this dependency if you want to use Mockito 
    compile 'org.mockito:mockito-core:1.10.19' 
    // some more .. 
} 

當我建立.apk文件時,這個.apk包含junit庫。 我如何從.apk中排除這個junit庫? 我已經從過去幾天裏搜索這些問題,但可以找到解決方案。 請幫助我。

+0

在這裏發佈你的gradle。 –

+0

這個依賴我添加在我的gradle文件中依賴關係編譯fileTree(dir:'libs',include:'* .jar') //單元測試依賴關係 compile'junit:junit:4.12' // Set這種依賴如果你想使用Mockito 編譯'org.mockito:mockito-core:1.10.19'}' –

+0

@Suhas:這是足夠的部分從gradle你你需要整個gradle文件它的非常大的文件? –

回答

0

使用testCompile而不是compile作爲單元測試依賴關係;用於儀器測試依賴性的androidTestCompile

+0

@Suhas:我該如何檢查其他庫項目包含junit依賴 –

+0

@葉戈爾:我曾嘗試過。我已經添加testCompile,然後它不會檢測junit庫。 –

+0

你是否在單元測試中使用JUnit? – Egor

相關問題