gpt4 book ai didi

Android项目依赖需要不同版本的Android Gradle插件

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:46 26 4
gpt4 key购买 nike

我的 Android 项目的 gradle 构建失败,因为我的项目的依赖项需要旧版本的 android gradle 插件:

Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-core/1.0.1.RELEASE/spring-android-core-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-asm/3.0.7.RELEASE/spring-asm-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-core/3.0.7.RELEASE/spring-core-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-crypto/3.1.3.RELEASE/spring-security-crypto-3.1.3.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/social/spring-social-core/1.0.2.RELEASE/spring-social-core-1.0.2.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-auth/1.0.1.RELEASE/spring-android-auth-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.1.1/jackson-annotations-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.1.1/jackson-core-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.1.2/jackson-databind-2.1.2.jar

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':myapp'.
> Could not resolve all dependencies for configuration ':myapp:classpath'.
> Could not find any version that matches com.android.tools.build:gradle:0.7.+.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/
Required by:
phase1:myapp:unspecified > com.jakewharton.hugo:hugo-plugin:1.1.0

* 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: 20.894 secs

我的项目使用 com.android.tools.build:gradle:1.0.0,但依赖项 com.jakewharton.hugo 正在寻找 gradle:0.7.+。

这是我的 gradle 构建文件。

顶级build.gradle:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

allprojects {
repositories {
mavenCentral()
}
}

子项目build.gradle:

buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
}
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'hugo'

android {
compileSdkVersion 20
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 13
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
..
..
..

在 Github 上查找 Hugo,我确认 1.1.0 版本确实要求版本 0.7.+,但最新代码(未发布)使用新版本(1.1.0)

有没有办法让 Hugo 使用旧版本构建,同时使用新版本构建项目的其余部分?

我复制了顶层Hugo source directory from Github进入我的项目。我如何告诉 gradle 在那里找到 hugo 插件?

最佳答案

我们遇到了同样的问题。如果将存储库从 jcenter() 更改为 mavenCentral(),应该可以解决问题。也可以同时拥有两个存储库。

关于Android项目依赖需要不同版本的Android Gradle插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28143846/

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