title: Build fail using maven android with ActionBarSherlock and Roboguice
body: <p>I've started an Android project in my spare time a couple months ago. To allow friends to easily collaborate I want to use maven, but I fail to build my project.</p>
  
  <p>My project use ActionBarSherlock and Roboguice (and the Roboguice Sherlock lib to allow this collaboration). After hours trying to hack my pom I came with this :</p>
  
  <pre><code>&lt;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"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.github.armelbd&lt;/groupId&gt;
  &lt;artifactId&gt;my-places&lt;/artifactId&gt;
  &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;MyPlaces&lt;/name&gt;
  &lt;url&gt;https://github.com/armelbd/my-places&lt;/url&gt;
  
  &lt;issueManagement&gt;
      &lt;url&gt;https://github.com/armelbd/my-places/issues&lt;/url&gt;
      &lt;system&gt;GitHub Issues&lt;/system&gt;
  &lt;/issueManagement&gt;
  
  &lt;licenses&gt;
      &lt;license&gt;
          &lt;name&gt;Apache V2&lt;/name&gt;
          &lt;url&gt;http://www.apache.org/licenses/LICENSE-2.0&lt;/url&gt;
          &lt;distribution&gt;repo&lt;/distribution&gt;
      &lt;/license&gt;
  &lt;/licenses&gt;
  
  &lt;scm&gt;
      &lt;url&gt;https://github.com/armelbd/my-places&lt;/url&gt;
      &lt;connection&gt;scm:git:git://github.com/armelbd/my-places.git&lt;/connection&gt;
      &lt;developerConnection&gt;scm:git:git@github.com:armelbd/my-places.git&lt;/developerConnection&gt;
  &lt;/scm&gt;
  
  &lt;properties&gt; 
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; 
  &lt;/properties&gt; 
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android&lt;/groupId&gt;
          &lt;artifactId&gt;android&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
          &lt;version&gt;4.0.1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Dependency injection using Roboguice and Google Guice extensions --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.roboguice&lt;/groupId&gt;
          &lt;artifactId&gt;roboguice&lt;/artifactId&gt;
          &lt;version&gt;2.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.inject&lt;/groupId&gt;
          &lt;artifactId&gt;guice&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
          &lt;classifier&gt;no_aop&lt;/classifier&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.inject.extensions&lt;/groupId&gt;
          &lt;artifactId&gt;guice-multibindings&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.inject.extensions&lt;/groupId&gt;
          &lt;artifactId&gt;guice-assistedinject&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Action Bar sherlock --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.actionbarsherlock&lt;/groupId&gt;
          &lt;artifactId&gt;library&lt;/artifactId&gt;
          &lt;version&gt;4.0.0&lt;/version&gt;
          &lt;type&gt;apklib&lt;/type&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Let Roboguice and Sherlock work together --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.github.rtyley&lt;/groupId&gt;
          &lt;artifactId&gt;roboguice-sherlock&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;plugins&gt;
         &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
              &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;sdk&gt;
                      &lt;platform&gt;15&lt;/platform&gt;
                  &lt;/sdk&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>But I get these errors :</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building MyPlaces 0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ my-places ---
  [debug] execute contextualize
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /Users/bourgona/Project/my-   places/src/main/resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:2.5:compile (default-compile) @ my-places ---
  [INFO] Compiling 18 source files to /Users/bourgona/Project/my-places/target/classes
  [INFO] -------------------------------------------------------------
  [ERROR] COMPILATION ERROR : 
  [INFO] -------------------------------------------------------------
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[3,25] cannot find symbol
  symbol  : class R
  location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[8,33] package  com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[9,33] package com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[22,7] cannot access   com.actionbarsherlock.app.SherlockFragment
  class file for com.actionbarsherlock.app.SherlockFragment not found
  public class AddressBarFragment extends RoboSherlockFragment {
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[65,33] cannot find symbol
  symbol  : class Menu
  location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[65,44] cannot find symbol
  symbol  : class MenuInflater
  location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[10,25] cannot find   symbol
  symbol  : class R
  location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/PlacesActivity.java:[3,33] package   com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[4,33] package  com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[8,25] cannot find symbol
  symbol  : class R
  location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[13,7] cannot access  com.actionbarsherlock.app.SherlockFragmentActivity
  class file for com.actionbarsherlock.app.SherlockFragmentActivity not found
  public class PlacesActivity extends RoboSherlockFragmentActivity {
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[32,39] cannot find symbol
  symbol  : class Menu
  location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[32,2] cannot find symbol
  symbol  : variable super
  location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[36,57] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[36,10] cannot find symbol
  symbol  : method getLayoutInflater(android.os.Bundle)
  location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[53,2] cannot find symbol
  symbol  : variable this
  location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[30,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[56,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[67,23] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[64,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[40,13] package R   does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[129,54] package R  does not exist
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/PlacesActivity.java:[21,8] cannot find symbol
  symbol  : variable super
  location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[22,24] package R does not exist
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[25,42] cannot find symbol
  symbol  : method getSupportFragmentManager()
  location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[27,27] cannot find symbol
  symbol  : method add(net.esial.myplaces.views.AddressBarFragment,java.lang.String)
  location: class android.support.v4.app.FragmentTransaction
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[18,4] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[34,8] cannot find symbol
  symbol  : class MenuInflater
  location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[34,32] cannot find symbol
  symbol  : method getSupportMenuInflater()
  location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[35,26] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[31,4] method does not override or   implement a method from a supertype
  [INFO] 31 errors 
  [INFO] -------------------------------------------------------------
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.914s
  [INFO] Finished at: Sun Jun 03 19:54:15 PDT 2012
  [INFO] Final Memory: 12M/81M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile  (default-compile) on project my-places: Compilation failure: Compilation failure:
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[3,25] cannot find symbol
  [ERROR] symbol  : class R
  [ERROR] location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[8,33] package com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[9,33] package  com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[22,7] cannot access  com.actionbarsherlock.app.SherlockFragment
  [ERROR] class file for com.actionbarsherlock.app.SherlockFragment not found
  [ERROR] public class AddressBarFragment extends RoboSherlockFragment {
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[65,33] cannot find symbol
  [ERROR] symbol  : class Menu
  [ERROR] location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[65,44] cannot find symbol
  [ERROR] symbol  : class MenuInflater
  [ERROR] location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[10,25] cannot find  symbol
  [ERROR] symbol  : class R
  [ERROR] location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[3,33] package  com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[4,33] package  com.actionbarsherlock.view does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[8,25] cannot find symbol
  [ERROR] symbol  : class R
  [ERROR] location: package net.esial.myplaces
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[13,7] cannot access com.actionbarsherlock.app.SherlockFragmentActivity
  [ERROR] class file for com.actionbarsherlock.app.SherlockFragmentActivity not found
  [ERROR] public class PlacesActivity extends RoboSherlockFragmentActivity {
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[32,39] cannot find symbol
  [ERROR] symbol  : class Menu
  [ERROR] location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[32,2] cannot find symbol
  [ERROR] symbol  : variable super
  [ERROR] location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[36,57] package R does not exist
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[36,10] cannot find symbol
  [ERROR] symbol  : method getLayoutInflater(android.os.Bundle)
  [ERROR] location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[53,2] cannot find symbol
  [ERROR] symbol  : variable this
  [ERROR] location: class net.esial.myplaces.views.AddressBarFragment
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/AddressBarFragment.java:[30,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my-  places/src/net/esial/myplaces/views/AddressBarFragment.java:[56,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[67,23] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/AddressBarFragment.java:[64,1] method does not override or  implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[40,13] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/controllers/AddressAutoCompleteAdapter.java:[129,54] package R does not exist
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[21,8] cannot find symbol
  [ERROR] symbol  : variable super
  [ERROR] location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[22,24] package R does not exist
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[25,42] cannot find symbol
  [ERROR] symbol  : method getSupportFragmentManager()
  [ERROR] location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[27,27] cannot find symbol
  [ERROR] symbol  : method add(net.esial.myplaces.views.AddressBarFragment,java.lang.String)
  [ERROR] location: class android.support.v4.app.FragmentTransaction
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[18,4] method does not override or implement a method from a supertype
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[34,8] cannot find symbol
  [ERROR] symbol  : class MenuInflater
  [ERROR] location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[34,32] cannot find symbol
  [ERROR] symbol  : method getSupportMenuInflater()
  [ERROR] location: class net.esial.myplaces.views.PlacesActivity
  [ERROR] /Users/bourgona/Project/my- places/src/net/esial/myplaces/views/PlacesActivity.java:[35,26] package R does not exist
  [ERROR] /Users/bourgona/Project/my-places/src/net/esial/myplaces/views/PlacesActivity.java:[31,4] method does not override or implement a method from a supertype
  [ERROR] -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the  following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  
  <p>What's wrong with my configuration ?</p>
  
  <h2>Update</h2>
  
  <p>After adding <code>&lt;packaging&gt;apk&lt;/packaging&gt;</code> I get this error :</p>
  
  <pre><code>[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
  [INFO] java.lang.IllegalArgumentException: already added: Lcom/google/inject/AbstractModule;
  [INFO]  at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
  [INFO]  at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
  [INFO]  at com.android.dx.command.dexer.Main.processClass(Main.java:486)
  [INFO]  at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
  [INFO]  at com.android.dx.command.dexer.Main.access$400(Main.java:67)
  [INFO]  at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
  [INFO]  at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
  [INFO]  at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
  [INFO]  at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
  [INFO]  at com.android.dx.command.dexer.Main.processOne(Main.java:418)
  [INFO]  at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
  [INFO]  at com.android.dx.command.dexer.Main.run(Main.java:206)
  [INFO]  at com.android.dx.command.dexer.Main.main(Main.java:174)
  [INFO]  at com.android.dx.command.Main.main(Main.java:95)
  [INFO] 1 error; aborting
  </code></pre>