我通过Android Studio安装了TestNG插件。在我的文件系统上安装了以下文件:
C:\Program Files\Android\Android Studio\plugins\testng\lib\testng.jar
C:\Program Files\Android\Android Studio\plugins\testng\lib\testng-plugin.jar
C:\Program Files\Android\Android Studio\plugins\testng\lib\resources_en.jar
C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1\lib\plugins\testng-6.3.1.jar
我将TestNG依赖项添加到模块的build.gradle
- 而不是“项目”:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
testCompile 'testng:testng:6.3.1' // Added this line
}
但Gradle无法找到该库:
Error:Gradle: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugUnitTestCompile'.
> Could not find testng:testng:6.3.1.
Searched in the following locations:
https://jcenter.bintray.com/testng/testng/6.3.1/testng-6.3.1.pom
https://jcenter.bintray.com/testng/testng/6.3.1/testng-6.3.1.jar
file:/C:/Users/UserFoo/AppData/Local/Android/sdk/extras/android/m2repository/testng/testng/6.3.1/testng-6.3.1.pom
file:/C:/Users/UserFoo/AppData/Local/Android/sdk/extras/android/m2repository/testng/testng/6.3.1/testng-6.3.1.jar
file:/C:/Users/UserFoo/AppData/Local/Android/sdk/extras/google/m2repository/testng/testng/6.3.1/testng-6.3.1.pom
file:/C:/Users/UserFoo/AppData/Local/Android/sdk/extras/google/m2repository/testng/testng/6.3.1/testng-6.3.1.jar
Required by:
MyBlackjack2:app:unspecified
如何将TestNG添加到搜索路径?另一方面,Android Studio在该位置安装了该插件是有原因的,但是将它包含在我的项目中的最佳方式是什么?
答案 0 :(得分:1)
使用TestNG 6.9.4,它分布在JCenter和Maven上(6.3.1仅在Maven Central上,您的存储库列表中似乎没有)。