问题是gradle找不到依赖项的jar,但gradle找错了地方。Gradle一直在错误的目录(谷歌和Android支持libary的目录)中搜索文件....
在以下位置搜索:文件:/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/google/m2repository/androis-sdks/extras/spring-android-rest-template-1.0.1.release.pom 2repository/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.jar
gradle不应该查找本地的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
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')
}
我使用Intellij15.0.3和Gradle2.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的截图显示没有错误-
从Android SDK Manager工具中,您需要从“Extras”安装“Android Support Repository”和“Google Repository”。它们安装特殊的本地Maven存储库(不在~/.m2/
中,而是在SDK安装中),可以很好地解决依赖关系。
失败:生成失败,出现异常。 > 出错原因:任务“:compiledebug”执行失败。 找不到系统Java编译器。确保您已经安装了JDK(而不仅仅是JRE),并将JAVA_HOME系统变量配置为指向fight目录。 编辑3: 再一次,Android Studio在编译我的项目时失败了。现在它停在。当我尝试用gradle通过命令行编译时,它没有任何错误...天哪,我恨格雷德尔!
虽然我看到两个不同的帖子与此错误消息没有任何关系: 错误:(25,17)无法解析:org.mockito:mockito-core:1.10.19 我尝试使用compile、androidTestCompile和testCompile更改Mockito依赖项,并在全局Gradle文件中尝试添加Maven作为存储库,但没有成功。 编辑:我正在使用Android Studio 2.1 这是我的应用程序
我希望有人面对同样的问题来解决依赖。下面提到的文件 xsi:schemalocation=“http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”xmlns=“http://maven.apache.org/pom/4.0.0”xmlns:xsi=“http://www.w3.org/2001/x
我对Android的Gradle构建有问题。我尝试了很多方法来解决这个问题,但没有什么不起作用。我需要帮助。 Gradle版本:4.4 Gradle插件:3.0.1 错误:无法解析app@serverDebug /compileClasspath的依赖关系:无法解析项目:vksdk_library。 错误:无法解析“”的依存关系:app@mockDebugAndroidTest/compileCl
我是Android Studio的新手,面临以下错误。 错误:无法解析“:”的依赖项app@debug/compileClasspath“:无法解析项目:floatinglibrary。显示受影响模块的详细信息:应用 错误:无法解析“:app@debug/编译类路径”的依赖关系:无法解析项目:d时间筛选库。显示详细信息 受影响的模块:应用
我想通过Jenkins用maven Build运行一个项目。 使用的存储库-Git从存储库中提取代码 使用的构建工具--Maven 我的jenkins控制台输出 请注意:-如果你看不到图像,只需使用Ctrl++缩放即可