gpt4 book ai didi

android - 为什么android gradle找不到junit?为什么不在远程存储库中搜索它?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:36:38 25 4
gpt4 key购买 nike

为什么它不在远程存储库中搜索它?

毕竟我在我的 gradle 脚本的顶部 mavenCentral()

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "20.0.0"

和:

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':lvl-licensing')
testCompile 'junit:junit:4.12'
}

结果是:

$ ./gradlew --info build
.
.
.
Creating configuration testReleaseProvided.
Creating configuration testReleaseWearApp.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':myapp'.
> Could not resolve all dependencies for configuration ':myapp:_debugUnitTestCompile'.
> Could not find junit:junit:4.12.
Searched in the following locations:
file:/home/myuser/Android/Sdk/extras/android/m2repository/junit/junit/4.12/junit-4.12.pom
file:/home/myuser/Android/Sdk/extras/android/m2repository/junit/junit/4.12/junit-4.12.jar
file:/home/myuser/Android/Sdk/extras/google/m2repository/junit/junit/4.12/junit-4.12.pom
file:/home/myuser/Android/Sdk/extras/google/m2repository/junit/junit/4.12/junit-4.12.jar
Required by:
myapp-container:myapp:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 7.023 secs
Stopped 0 compiler daemon(s).

最佳答案

我搬家了

repositories {
mavenCentral()
}

不在扇区内

buildScript {
}

并添加到 buildScript {

部分

uri

repositories {
maven { url 'http://repo1.maven.org/maven2' }
}

它解决了它..

关于android - 为什么android gradle找不到junit?为什么不在远程存储库中搜索它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29142899/

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