Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing artifact com.android.support:support-v4:jar:21.0.0-rc1 #246

Open
simongladkoskok opened this issue Aug 6, 2014 · 9 comments
Open

Comments

@simongladkoskok
Copy link

Hi I am new to Maven. I am trying to convert existing Eclipse Android project to Maven Central. Its an open source project. support-v7-appcompat, support-v7-mediarouter and appcompat_v7 are dependencies in the project. So I used sdk deployer to add to local repo. But it gives me an error missing artifact com.android.support:support-v4:jar:21.0.0-rc1 in Eclipse and when I am trying to mvn clean install.
Here is my POM file.
Please help.


4.0.0
com.connectsdk
Connect-SDK-Android
1.3.1
pom
Connect SDK
Connect SDK is an open source framework that connects your
mobile apps with multiple TV platforms.

<licenses>
    <license>
        <name>Apache License, Version 2.0</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        <distribution>repo</distribution>
    </license>
</licenses>

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

<dependencies>
    <dependency>
        <groupId>org.java-websocket</groupId>
        <artifactId>Java-WebSocket</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-appcompat</artifactId>
        <version>20.0.0</version>
        <type>apklib</type>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-appcompat</artifactId>
        <version>20.0.0</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-mediarouter</artifactId>
        <version>20.0.0</version>
        <type>apklib</type>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-mediarouter</artifactId>
        <version>20.0.0</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>21.0.0-rc1</version>
        <type>aar</type>
    </dependency>
</dependencies>
<build>

    <finalName>${project.artifactId}</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>${android.plugin.version}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <sdk>
                    <platform>16</platform>
                </sdk>
            </configuration>
        </plugin>
    </plugins>
</build>
@mstevens83
Copy link

Same problem here

@mstevens83
Copy link

Run this: mvn install -pl repositories/android-m2repository

@degill
Copy link

degill commented Nov 7, 2014

I have the same problem.

I want to use the appcompat-v7 library as an aar. So I do

    mvn clean deploy

within maven-android-sdk-deployer/repositories, then I look up the artifact on my nexus and find

    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>21.0.0</version>
        <type>aar</type>
    </dependency>

The problem is, appcompat-v7 depends on v4, to be exact it depends on

    com.android.support:support-v4:jar:21.0.0:compile

which is not deployed from the /repositories folder. Only an aar is deployed from it (which would be fine for me, if appcompat-v7 would use it)
And if I do a

    mvn deploy

from the maven-android-sdk-deployer/extras/compatibility-v4 folder I get a

    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v4</artifactId>
        <version>21.0.1</version>
    </dependency>

on my nexus which wont be recognized by appcompat.

Soooo I have no idea what to do, how to add v4 and v7-appcompat to my pom to be ready to build it via maven :-(

@degill
Copy link

degill commented Nov 7, 2014

So basically, adding this to my pom does not work:

<dependency>
    <groupId>com.android.support</groupId>
    <artifactId>support-v4</artifactId>
    <version>21.0.0</version>
    <type>aar</type>
</dependency>

<dependency>
    <groupId>com.android.support</groupId>
    <artifactId>appcompat-v7</artifactId>
    <version>21.0.0</version>
    <type>aar</type>
</dependency>

@mingfai
Copy link
Contributor

mingfai commented Nov 12, 2014

for the particular problem of missing "com.android.support:support-v4:jar:21.0.0:compile", other than exclude it with:

            <groupId>com.android.support</groupId>
            <artifactId>appcompat-v7</artifactId>
            <version>21.0.0</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>support-v4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

you can also install it by

  1. edit $ANDROID_SDK_HOME/extras/android/support/source.properties to ensure Pkg.Revision is correct
    for mac, it's /Applications/android-sdk-macosx/extras/android/support/source.properties
  2. install the jar with
    mvn install -pl extras/compatibility-v4 -Dextras.compatibility.v4.groupid=com.android.support -Dextras.compatibility.v4.artifactid=support-v4

for my case, installing the jar removed a warning but doesn't seem to help to get it work.

as there are maven directory structure provided for the aar, instead of rely on maven-android-sdk-deployer to copy the aar around, I added a repository definition as follows:

<repositories>
        <repository>
            <id>android-local</id>
            <url>file:/Applications/android-sdk-macosx/extras/android/m2repository</url>
        </repository>
    </repositories>

@snuk182
Copy link

snuk182 commented Nov 20, 2014

The only way to heal this I've found is following. Yes, it's really bad and should be used extremely careful (till the day Android guys fix their provided maven repo).

Navigate to location of appcompat-v7 pom.xml in your local repository and open it for editing. And insert 'aar' to 'support-v4' dependency. Like this:

<?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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.android.support</groupId>
  <artifactId>appcompat-v7</artifactId>
  <version>21.0.2</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-v4</artifactId>
      <version>21.0.2</version>
      <type>aar</type>     
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

@mstevens83
Copy link

Perhaps maven-android-sdk-deployer could be made to automatically insert that <type>aar</type line the pom.xml when appcompat-v7 is being installed to the local repo?
(At least until Google fixes it on their end)

@mosabua
Copy link
Member

mosabua commented Dec 10, 2014

If you send a pull request that does that .. I can merge it.

@mstevens83
Copy link

I might have a go at that next week ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants