maven android plugin with error ( dependency=[android.support:compatibility-v7:apklib:19:compile] not found )

984 views Asked by At

I am using maven 3.1.1. with Eclipse Kepler installed with Android-Configurator-for-M2E.

My POM.XML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.company.sample</groupId>
    <artifactId>SampleApplication</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>SampleApplication</name>
    <description>A sample application to demo clean android code.</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version>2.3.1</platform.version>
        <android.plugin.version>3.6.0</android.plugin.version>
    </properties>

    <dependencies>
        <!-- android SDK -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>2.3.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- support-v4 -->
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>support-v4</artifactId>
            <version>19.0.0</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.android</groupId>
                    <artifactId>support-v4</artifactId>
                </exclusion>
            </exclusions>

        </dependency>

        <!-- v7-extra -->
        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7</artifactId>
            <version>19</version>
            <type>apklib</type>
        </dependency>

        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7</artifactId>
            <version>19</version>
            <type>jar</type>
        </dependency>

        <!-- v7-appcompat -->
        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7-appcompat</artifactId>
            <version>19</version>
            <type>apklib</type>
        </dependency>

        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7-appcompat</artifactId>
            <version>19</version>
            <type>jar</type>
        </dependency>

    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.6.0</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <configuration>
                        <sdk>
                            <platform>18</platform>
                        </sdk>
                        <action>
                            <ignore></ignore>
                        </action>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <path>${env.ANDROID_HOME}</path>
                        <platform>18</platform>
                    </sdk>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                </configuration>
                <extensions>true</extensions>
            </plugin>

        </plugins>

    </build>

    <profiles>
        <profile>
            <id>allow-snapshots</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>snapshots-repo</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

</project>

The command: mvn clean install, builds successfully, but refreshing the project in eclipse gives this error:

dependency=[android.support:compatibility-v7:apklib:19:compile] not found in workspace  pom.xml /SampleApplication  line 1  me.gladwell.eclipse.m2e.android.markers.dependency.apklib

snapshot of eclipse situation

1

There are 1 answers

0
revolutionary On

Fixed this problem by downloading a new copy of eclipse 4.3.1 and re-installed the following:

  1. ADT pluugin
  2. M2E
  3. M2E-Android

Then imported the same project which built fine with: mvn clean install.

Then removed all the Libraries from the build path and did: Android-Tools>Fix Project Properties.