问题是gradle无法找到依赖项的jar,但gradle正在寻找错误的地方。 Gradle不断搜索错误目录中的文件(Google& Android支持库所在的目录....
在以下位置搜索: 文件:/ d:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1。 RELEASE.pom 文件:/ d:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1。 RELEASE.jar 文件:/ d:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1。 RELEASE.pom 文件:/ d:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1。 RELEASE.jar 要求:
不应该在本地Maven资源库中查看或尝试从jcenter或mavencentral下载吗?
“〜/ .m2 / repository / org / springframework / android / spring-android-rest-template / 1.0.1.RELEASE / spring-android-rest-template-1.0.1.RELEASE.jar”
我已经尝试清空gradle缓存并尝试了不同的存储库 - 但到目前为止还没有成功!
感谢您的帮助!
错误消息
D:\Progs\JAVA\jdk1.7.0_80\bin\java -Dgradle.home=D:\Progs\gradle-2.4
-Dtools.jar=D:\Progs\JAVA\jdk1.7.0_80\lib\tools.jar -Didea.launcher.port=7540 "-Didea.launcher.bin.path=D:\Progs\JetBrains\IntelliJ IDEA 15.0.3\bin"
-Dfile.encoding=UTF-8 -classpath "D:\Progs\gradle-2.4\lib\groovy-all-2.3.10.jar;D:\Progs\gradle-2.4\lib\ant-1.9.4.jar;D:\Progs\gradle-2.4\lib\ant-launcher-1.9.4.jar;D:\Progs\gradle-2.4\lib\gradle-base-services-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-base-services-groovy-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-cli-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-core-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-docs-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-launcher-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-messaging-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-model-core-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-model-groovy-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-native-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-open-api-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-resources-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-tooling-api-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-ui-2.4.jar;D:\Progs\gradle-2.4\lib\gradle-wrapper-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-announce-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-antlr-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-build-comparison-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-build-init-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-code-quality-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-dependency-management-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-diagnostics-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-ear-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-ide-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-ide-native-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-ivy-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-jacoco-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-javascript-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-jetty-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-language-groovy-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-language-java-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-language-jvm-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-language-native-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-language-scala-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-maven-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-osgi-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-platform-base-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-platform-jvm-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-platform-native-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-platform-play-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-plugin-development-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-plugin-use-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-plugins-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-publish-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-reporting-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-resources-http-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-resources-s3-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-resources-sftp-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-scala-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-signing-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-sonar-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-testing-native-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\gradle-tooling-api-builders-2.4.jar;D:\Progs\gradle-2.4\lib\plugins\ivy-2.2.0.jar;D:\Progs\JetBrains\IntelliJ IDEA 15.0.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.gradle.launcher.GradleMain --build-file C:\Users\pk\Documents\IntelliJProjetcs2\app\build.gradle
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'app'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find org.springframework.android:spring-android-rest-template:1.0.1.RELEASE.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.pom
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.jar
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.pom
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.jar
Required by:
:app:unspecified
> Could not find any matches for org.springframework.android:spring-android-auth:1.+ as no versions of org.springframework.android:spring-android-auth are available.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-auth/maven-metadata.xml
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-auth/
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-auth/maven-metadata.xml
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-auth/
Required by:
:app:unspecified
> Could not find any matches for org.springframework.android:spring-android-core:1.+ as no versions of org.springframework.android:spring-android-core are available.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-core/maven-metadata.xml
file:/D:/Programme/androis-sdks/extras/android/m2repository/org/springframework/android/spring-android-core/
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-core/maven-metadata.xml
file:/D:/Programme/androis-sdks/extras/google/m2repository/org/springframework/android/spring-android-core/
Required by:
:app:unspecified
> Could not find com.google.code.gson:gson:2.5.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/com/google/code/gson/gson/2.5/gson-2.5.pom
file:/D:/Programme/androis-sdks/extras/android/m2repository/com/google/code/gson/gson/2.5/gson-2.5.jar
file:/D:/Programme/androis-sdks/extras/google/m2repository/com/google/code/gson/gson/2.5/gson-2.5.pom
file:/D:/Programme/androis-sdks/extras/google/m2repository/com/google/code/gson/gson/2.5/gson-2.5.jar
Required by:
:app:unspecified
> Could not find com.fasterxml.jackson.core:jackson-databind:2.5.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/com/fasterxml/jackson/core/jackson-databind/2.5/jackson-databind-2.5.pom
file:/D:/Programme/androis-sdks/extras/android/m2repository/com/fasterxml/jackson/core/jackson-databind/2.5/jackson-databind-2.5.jar
file:/D:/Programme/androis-sdks/extras/google/m2repository/com/fasterxml/jackson/core/jackson-databind/2.5/jackson-databind-2.5.pom
file:/D:/Programme/androis-sdks/extras/google/m2repository/com/fasterxml/jackson/core/jackson-databind/2.5/jackson-databind-2.5.jar
Required by:
:app:unspecified
> Could not find javax.persistence:persistence-api:1.0.1.
Searched in the following locations:
file:/D:/Programme/androis-sdks/extras/android/m2repository/javax/persistence/persistence-api/1.0.1/persistence-api-1.0.1.pom
file:/D:/Programme/androis-sdks/extras/android/m2repository/javax/persistence/persistence-api/1.0.1/persistence-api-1.0.1.jar
file:/D:/Programme/androis-sdks/extras/google/m2repository/javax/persistence/persistence-api/1.0.1/persistence-api-1.0.1.pom
file:/D:/Programme/androis-sdks/extras/google/m2repository/javax/persistence/persistence-api/1.0.1/persistence-api-1.0.1.jar
Required by:
:app:unspecified
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.085 secs
Process finished with exit code 1
我的Gradle构建脚本:
buildscript {
repositories {
// def androidHome = System.getenv("ANDROID_HOME")
// def userProfile = System.getenv("USERPROFILE")
//maven { url "$androidHome/extras/android/m2repository/" }
//maven { url "$androidHome/extras/google/m2repository/"}
// maven { url "$userProfile/.m2/repository/"}
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
defaultConfig {
applicationId "com.pekam"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile('org.springframework.android:spring-android-auth:1.+') {
exclude group: 'org.springframework', module: 'spring-core'
}
compile('org.springframework.android:spring-android-core:1.+') {
exclude group: 'org.springframework', module: 'spring-core'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.code.gson:gson:2.5'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5'
compile files('libs/slf4j-android-1.6.1-RC1.jar')
compile 'javax.persistence:persistence-api:1.0.1'
compile files('libs/ent.jar')
}
修改
下面是无法通过gradle解析的库,如果我从gradle.build中删除它们,项目编译正常。 ......其他的图书馆(Appcombat& GooglePlay)编译得很好......
我使用IntelliJ 15.0.3和gradle 2.4
> compile
> ('org.springframework.android:spring-android-rest-template:1.0.1.RELEASE')
> compile ('org.springframework.android:spring-android-auth:1.+') {
> exclude group: 'org.springframework', module: 'spring-core'
> }
> compile ('org.springframework.android:spring-android-core:1.+') {
> exclude group: 'org.springframework', module: 'spring-core'
> }
>
>
> compile 'com.google.code.gson:gson:2.5'
> compile 'com.fasterxml.jackson.core:jackson-databind:2.5'
>
> compile 'javax.persistence:persistence-api:1.0.1'
IntelliJ中的Libaries屏幕截图显示没有错误 -
答案 0 :(得分:0)
在Android SDK Manager工具中,您需要安装" Android支持存储库"和" Google Repository "来自" Extras "。这些安装了特殊的本地Maven存储库(不在~/.m2/
,但在SDK安装中),这将使您的依赖关系解决方案。