3

I’m new maven user. I want to build my android application which consists of roboguice and actionbarsherlock dependence. My problem is actionbarsherlock dependence. I include it by

    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>actionbarsherlock</artifactId>
        <version>4.2.0</version>
        <type>apklib</type>
    </dependency>

    <!-- Let Roboguice and Sherlock work together -->
    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
        <version>1.4</version>
    </dependency>

in module pom.xml file, but my editor cannot import actionbarsherlock view classes. In package explorer in maven dependenceies there isn't any actionbarsherlock jar, but missed files are in target/unpack/apklibs/com.actionbarsherlock_actionbarsherlock_apklib_4.2.0/src/com/actionbarsherlock/view

How to set up correctly actionbarsherlock dependency ???

My development IDE is eclipse. I have installed m2e, android configuration for m2e in eclipse, and can import android maven project.

My project has 2 modules: application and facebook sdk. I set up android version to 15.

In pom.xml file:

<?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>
<artifactId>application</artifactId>
<name>Grand</name>
<packaging>apk</packaging>

<parent>
    <groupId>pl.grand</groupId>
    <artifactId>Grand</artifactId>
    <version>1.0.0</version>
    <relativePath>../pom.xml</relativePath>
</parent>

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

    <dependency>
        <groupId>org.roboguice</groupId>
        <artifactId>roboguice</artifactId>
        <version>2.0</version>
    </dependency>

    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>actionbarsherlock</artifactId>
        <version>4.2.0</version>
        <type>apklib</type>
    </dependency>

    <!-- Let Roboguice and Sherlock work together -->
    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
        <version>1.4</version>
    </dependency>

    <!-- facebook sdk -->
    <dependency>
        <groupId>com.facebook.android</groupId>
        <artifactId>facebook-android-sdk</artifactId>
        <version>1.0.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <platform>15</platform>
                </sdk>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin> 
    </plugins>
</build>

granan
  • 341
  • 1
  • 4
  • 18
  • 1
    apklib only works from command-line when you build the project. In order to use it in Eclipse, you still need import the actionbarsherlock source project into Eclipse, pretty much like what we do for a regular Android library project, more details in [this answer](http://stackoverflow.com/questions/8831481/apklib-does-not-get-installed-in-maven-repo/8831891#8831891). – yorkw Nov 23 '12 at 23:57

1 Answers1

4

I've been caught by that a few times, you gotta actually add both the APKLIB and JAR dependencies to your project (where the APKLIb brings the resources and all that is part of the Android Library project) and the JAR brings the compiled classes.

In effect:

<dependency>
    <groupId>com.actionbarsherlock</groupId>
    <artifactId>actionbarsherlock</artifactId>
    <version>4.2.0</version>
    <type>apklib</type>
</dependency>

<dependency>
    <groupId>com.actionbarsherlock</groupId>
    <artifactId>actionbarsherlock</artifactId>
    <version>4.2.0</version>
    <type>jar</type>
</dependency>
Roberto Andrade
  • 1,793
  • 1
  • 21
  • 27