首页 > 解决方案 > How to download support-v4 library with maven manually?

问题描述

I want to download support-v4 library with maven, so I downloaded the pom file (support-compat-26.1.0.pom) from the website first, then I added plugin and repository sections to it, finally I ran the following command:

mvn.cmd -f support-v4-26.1.0.pom dependency:copy-dependencies

The plugin was successfully downloaded, but after that maven tried to look for support-compat-26.1.0.jar and failed (since there is only support-compat-26.1.0.aar in the repository).

The pom file contains the line <packaging>aar</packaging>. Is the plugin not working? how can I tell maven to find aar not jar? (Changing packaging to apk is still not help.)

Here is the support-compat-26.1.0.pom

<?xml version="1.0" encoding="UTF-8"?>
<project 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/XMLSchema-instance">

<build>
<plugins>
<plugin>
    <groupId>com.simpligility.maven.plugins</groupId>
    <artifactId>android-maven-plugin</artifactId>
    <version>4.6.0</version>
    <extensions>true</extensions>         
    <configuration>
        <sign>
            <debug>false</debug>
        </sign>
    </configuration>
</plugin>
</plugins>
</build>

<repositories>
    <repository>
        <id>google</id>
        <url>https://maven.google.com</url>
    </repository>
</repositories>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.android.support</groupId>
  <artifactId>support-v4</artifactId>
  <version>26.1.0</version>
  <packaging>aar</packaging>
  <name>Android Support Library v4</name>
  <description>The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.</description>
  <url>http://developer.android.com/tools/extras/support-library.html</url>
  <inceptionYear>2011</inceptionYear>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>The Android Open Source Project</name>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:https://android.googlesource.com/platform/frameworks/support</connection>
    <url>http://source.android.com</url>
  </scm>
  <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-compat</artifactId>
      <version>26.1.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-media-compat</artifactId>
      <version>26.1.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-core-utils</artifactId>
      <version>26.1.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-core-ui</artifactId>
      <version>26.1.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-fragment</artifactId>
      <version>26.1.0</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

标签: androidmavenandroid-support-library

解决方案


推荐阅读