Android的摇篮失败之后,干净的构建(取决于AAR与本地库) [英] Android Gradle fails to build after clean (depends on AAR with native libraries)

查看:218
本文介绍了Android的摇篮失败之后,干净的构建(取决于AAR与本地库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android库项目( projA )依赖于另一个库项目( projB )。我也有一个内部的Maven服务器(Archiva)。 projA 包含这些行:

I have an Android library project (projA) that depends on another library project (projB). I also have an internal Maven server (Archiva). projA contains these lines:

dependencies {
    maven { url 'http://company.com/internal/repository' }
    compile 'com.company:projB:2.0.7@aar'
    ...
}

projB 是与Android库的插件,发布到company.com Archiva服务器建立了一个AAR,它包含本地code。提取AAR显示存在.so文件,他们应该和包装JAR文件中也存在。如果我运行: ./ gradlew干净构建
构建失败,未解决的符号。但是,如果我跑

projB is an AAR that was built with the Android library plugin, published to the company.com Archiva server, and it contains native code. Extracting the AAR shows the .so files exist where they should be, and the wrapper JAR file exists as well. If I run: ./gradlew clean build the build fails with unresolved symbols. However, if I run

./gradlew clean build
./gradlew build

那么的第二的版本一定会成功!

这是一个问题,例如,始终使用清洁,或者从源头控制得到一个新的副本生成服务器上。

This is a problem, for example, on build servers that always use clean, or get a fresh copy from source control.

这究竟是为什么,以及如何解决这个问题?

Why is this happening, and how do I fix it?

推荐答案

发生这种情况的原因是因为依赖线改变了,不再是正确的。我想不通为什么它会工作,1个内置后,但不是干净后。错误消息是不清晰!即使工件没有根据依赖性声明存在,也穿过该生成步骤和试图编译

The reason this happened was because the dependency line changed, and was no longer right. I cannot figure out why it would work after one build, but not after a clean. The error message isn't clear! Even though the artifact didn't exist according to the dependency declaration, it would pass through that build step and attempt to compile.

在年底,固定依赖修复了这个问题。

In the end, fixing the dependency fixed this issue.

该神器被命名为这样的:

The artifact is named like this:

com.company:artifact:1.2.0.0。+ @ AAR

这神器的存在。不过,有人误把它改为:

That artifact exists. However, someone mistakenly changed it to:

com.company:artifact:1.2.0.0.0。+ @ AAR

这是不存在的。我有这个神器的副本在我的本地〜/ .m2目录适合第一,但没有第二个。

That does not exist. I had a copy of this artifact in my local ~/.m2 that fits the first, but not the second.

所以,奇怪的是,依赖解析了假阳性,然后构建将失败。更糟糕的是,第二个版本(的没有的干净)将成功

So, strangely, the dependency resolution had a false positive, and then the build would fail. To make matters worse, the second build (without a clean) would succeed.

这篇关于Android的摇篮失败之后,干净的构建(取决于AAR与本地库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆