用Android Studio中导入第三方库工程的时候出现的问题:
Error:(28, 0) Cannot get property 'junitVersion' on extra properties extension as it does not exist
出现这种问题原因是第三方库工程 引用了 自定义的 junitVersion 这个名字的ext;
因此在该项目的根目录那个build.gradle里的ext加上junitVersion这个即可,如下
dependencies {
// App's dependencies, including test
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion"
compile "com.google.guava:guava:$rootProject.guavaVersion"// Dependencies for local unit tests
testCompile "junit:junit:$rootProject.ext.junitVersion"
testCompile "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testCompile "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion"
}