gpt4 book ai didi

导入模块构建时出现 Android 错误,gradle - 找不到方法 instrumentTestCompile()

转载 作者:太空宇宙 更新时间:2023-11-03 11:49:32 27 4
gpt4 key购买 nike

导入时 ListViewAnimation库,我得到重建错误

Error:(7) A problem occurred evaluating project ':library'.

Could not find method instrumentTestCompile() for arguments [org.mockito:mockito-core:1.9.5, build_n73cqp2judtlhpna5h10rio8c$_run_closure1_closure3@20e75be5] on project ':library'.

这是导入的模块build.gradle:

    apply plugin: 'android-library'


dependencies {
compile 'com.nineoldandroids:library:2.4.0'

instrumentTestCompile ('org.mockito:mockito-core:1.9.5') { exclude group: 'org.hamcrest' }
instrumentTestCompile ('com.google.dexmaker:dexmaker-mockito:1.0') { exclude group: 'org.hamcrest' }
instrumentTestCompile ('junit:junit:4.11') { exclude group: 'org.hamcrest' }
instrumentTestCompile 'org.hamcrest:hamcrest-all:1.3'
}

android {
compileSdkVersion 19
buildToolsVersion '19.0.1'

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

instrumentTest.setRoot('tests')
instrumentTest {
java.srcDirs = ['tests/java']
}
}

defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionName project.VERSION_NAME
versionCode Integer.parseInt(new Date().format('yyyyMMddHH'))
}

packagingOptions {
exclude 'LICENSE.txt'
}
}

apply from: '../maven_push.gradle'

问题是什么?

最佳答案

instrumentTest 在最近的 android-gradle-plugin 中被重命名为 androidTest

你必须在 build.gradle 中重命名:

  • instrumentTestCompile --> androidTestCompile
  • instrumentTest --> androidTest

关于导入模块构建时出现 Android 错误,gradle - 找不到方法 instrumentTestCompile(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25067325/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com