我有使用 Gradle 构建的应用程序,它需要 maven 模块 fs
.我的安卓应用需要版本 1.1
(存在于本地 maven 存储库中)但它不是本地 maven 存储库中模块的最新版本(版本 1.2
也在本地 maven 存储库中):
compile 'name.antonsmirnov.fs:fs:1.1'
尝试构建 android 应用程序时出现错误:
Executing tasks: [clean, :app:compileDebugSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve name.antonsmirnov.fs:fs:1.1.
Required by:
Ad_gradle:app:unspecified
> inconsistent module metadata found. Descriptor: name.antonsmirnov.fs:fs:1.2 Errors: bad version: expected='1.1' found='1.2'
> Could not resolve name.antonsmirnov.fs:dropbox:1.1.
我如何强制 Gradle 不使用最新版本的 Maven 模块( Artifact )?
PS。还有一个问题:如果我删除文件夹
1.2
从本地 maven repo 它没有帮助(所以 gradle 缓存了 1.2 可用并且即使在删除后也不会编译)。聚苯乙烯。即使我使用“+”作为版本以使 Gradle 获得最新的可用版本,它也无法解决它:
compile "name.antonsmirnov.fs:fs:+"
错误:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve name.antonsmirnov.fs:fs:+.
Required by:
Ad_gradle:app:unspecified
> inconsistent module metadata found. Descriptor: name.antonsmirnov.fs:fs:1.2 Errors: bad version: expected='1.1' found='1.2'
最佳答案
检查您的应用程序的 gradle 配置,您在其中指定要用于 Maven Artifact 的存储库。根据您的配置,这可能在您的顶层 build.gradle
文件或项目的文件(通常为 app/build.gradle
。)您需要添加 mavenLocal
为了获取您本地的 Maven Artifact :
repositories {
mavenLocal()
}
关于android - 如何在没有最新版本的 maven Artifact 的情况下使用 Gradle 构建 android 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35696864/