0

I'm trying to add various dependencies to an android maven project, in particular, these from a build.gradle file:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-cast:7.8.0'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:cardview-v7:22.0.0'
    compile 'com.android.support:mediarouter-v7:22.0.0'

    compile (name:'CastCompanionLibrary-debug', ext:'aar')
    compile 'com.github.amlcurran.showcaseview:library:5.0.0'
    compile 'com.chrisanderson.mediabrowsercompat:library:0.0.2'

}

I've been trying to follow the instructions here, which tells you to set a local repository with:

<repository>
  <id>android-support</id>
  <name>android-support</name>
  <url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
</repository>

But I'm getting the error:

ArtifactTransferException: Failure to transfer com.android.support:support-v4:jar:23.0.1 from file://${env.ANDROID_HOME}/extras/android/m2repository was cached in the local repository, resolution will not be reattempted until the update interval of android-support has elapsed or updates are forced. Original error: Could not transfer artifact com.android.support:support-v4:jar:23.0.1 from/to android-support (file://${env.ANDROID_HOME}/extras/android/m2repository): Repository path /extras/android/m2repository does not exist, and cannot be created.

Here's my full pom:

<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>xxx</groupId>
    <artifactId>xxx</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>

    <properties>
        <!-- at test time this will be overridden with snapshot version -->
        <it-plugin.version>4.3.0</it-plugin.version>
    </properties>


    <repositories>
        <repository>
            <id>android-support</id>
            <name>android-support</name>
            <url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
        </repository>
    </repositories>


    <build>
        <sourceDirectory>src</sourceDirectory>
        <finalName>${project.artifactId}</finalName>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.simpligility.maven.plugins</groupId>

                    <artifactId>android-maven-plugin</artifactId>
                    <version>${it-plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.simpligility.maven.plugins</groupId>

                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>23</platform>
                    </sdk>
                    <manifest>
                        <debuggable>true</debuggable>
                    </manifest>

                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>support-v4</artifactId>
            <version>23.0.1</version>
        </dependency>


    </dependencies>
</project>
Community
  • 1
  • 1
dessalines
  • 6,352
  • 5
  • 42
  • 59
  • check this [link](https://github.com/sveinungkb/wear-test/blob/master/build.gradle) for your gradle update – pRaNaY Oct 11 '15 at 06:42

2 Answers2

0

As per the error logs the ${env.ANDROID_HOME} is not resolving, can you try to hardcode the path and see if the errors goes way.

lazywiz
  • 1,091
  • 2
  • 13
  • 26
0

I suggest to use the Maven Android SDK Deployer instead. It will copy the files into your local Maven repo or deploy them to a repository manager. Then you can just declare them as normal dependencies without further config headaches in settings or the pom

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123