我们在一个项目中使用了Android版本17,并且希望升级到API版本19,因为应用程序运行在Android4.4上。
我们使用Maven作为构建环境。在我们的AndroidManifest.xml中,我已经替换了SDK 17到19的所有地方。但是我在通过Maven升级到4.4平台时遇到了问题。
我使用工具将android-4.4包推到本地Maven存储库中。然后,我在“父”POM.xml中替换了Androd-4.2对Androd-4.4的引用:
<dependencyManagement>
<dependencies>
<dependency>
<!-- <groupId>com.google.android</groupId> OLD -->
<groupId>android</groupId>
<artifactId>android</artifactId>
<!-- <version>4.2.2_r2</version> OLD -->
<version>4.4.2_r4</version>
<scope>provided</scope>
</dependency>这一变化似乎引起了一场冲突。另一个依赖项是引入与新的2.1_r1包冲突的安卓软件包的版本4.4.2_r4:
Excerpt from 'mvn dependency:tree':
.
[INFO] +- com.github.tony19:logback-android-classic:jar:1.0.10-2:compile
[INFO] | \- com.github.tony19:apktool-lib:jar:1.4.4-3:compile
[INFO] | \- com.google.android:android:jar:2.1_r1:compile
[INFO] | +- org.khronos:opengl-api:jar:gl1.1-android-2.1_r1:compile
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | \- xpp3:xpp3:jar:1.1.4c:compile我注意到,如果我将4.4包的<dependency>声明移至pom.xml中的logback-Android-经典依赖声明之上,那么我们的模块将使用4.4依赖项。然而,我不认为这是一个适当的解决办法,我遇到了各种各样的问题,构建项目作为一个整体。
那些对Maven更有经验的人可以建议解决这个问题的正确方法吗?
发布于 2015-08-19 06:55:05
遍历每个受影响的模块并在logback-android-经典依赖项中添加一个排除项,似乎解决了这个问题:
<exclusions>
<exclusion>
<artifactId>android</artifactId>
<groupId>android</groupId>
</exclusion>
<exclusion>
<artifactId>android</artifactId>
<groupId>com.google.android</groupId>
</exclusion>
</exclusions>https://stackoverflow.com/questions/32072651
复制相似问题