2015-08-13 61 views
0

我正在尝试APK Tests in Modules并经历了整个设置过程。它认为Gradle如果从jCenter以外的存储库中获取它们,则会发现应用模块的依赖关系存在问题。Android测试模块(Gradle Plugin 1.3):来自非默认maven库的依赖关系

一个依赖的是MPAndroidChart位于使用jitpack:

repositories { 
    maven { url "https://jitpack.io" } 
} 

plugin: 'com.android.test'似乎忽略这个子句:它不是从app模块传播。

报告的错误:

Error:A problem occurred configuring project ':test'. 
> Could not resolve all dependencies for configuration ':test:_debugCompile'. 
    > Could not find com.github.PhilJay:MPAndroidChart:v2.0.9. 
    Searched in the following locations: 
     https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom 
     https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar 
     file:/Users/me/Library/Android/sdk/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom 
     file:/Users/me/Library/Android/sdk/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar 
     file:/Users/me/Library/Android/sdk/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom 
     file:/Users/me/Library/Android/sdk/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar 
    Required by: 
     company-android-app:test:unspecified > company-android-app:app:unspecified 

回答

0

貌似问题可以通过明确地添加存储库到test模块可以省略:

repositories { 
    maven { url "https://jitpack.io" } 
    mavenCentral() 
} 

测试与buildToolsVersion '23.0.0rc3'classpath 'com.android.tools.build:gradle:1.3.0'

+0

它是个好主意把mavenCentral()作为Gradle检查它们之后的第一个回购。 – metrimer