I am trying to create a basic Android project using the android-quickstart archetype and add RoboGuice, ActionBarSherlock and RoboGuice-Sherlock dependencies to combine the two.
This is my pom.xml:
<?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>com.myapp</groupId> <artifactId>BaseApp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>apk</packaging> <name>BaseApp</name> <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>com.google.android</groupId> <artifactId>android</artifactId> <version>${platform.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.roboguice</groupId> <artifactId>roboguice</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> <version>1.3.9</version> </dependency> <dependency> <groupId>com.actionbarsherlock</groupId> <artifactId>actionbarsherlock</artifactId> <version>4.4.0</version> <type>apklib</type> </dependency> <dependency> <groupId>com.github.rtyley</groupId> <artifactId>roboguice-sherlock</artifactId> <version>1.5</version> </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> </project>
But m2eclipse will not work with this Pom.xml since it cannot find apklib dependency. Specifically, I get the following message on the Problems tab in Eclipse:
dependency=[com.actionbarsherlock:actionbarsherlock:apklib:4.4.0:compile] not found in workspace pom.xml /BaseApp line 1 me.gladwell.eclipse.m2e.android.markers.dependency.apklib
I tried to delete the <type>apklib</type> , but then my ABS resources (namely the required Themes) are not imported into the project.
I read in a few questions that the apklib type only works on the command line, and that if I want to stick with the IDE, I need to import the ABS manually as a library. I did this, but then RoboGuice will fail because the project becomes a library project and apparently the resource identifiers are no longer final in library projects. (Compile-time error - βThe value of the annotation attribute InjectView.value must be a constant expressionβ). For reference, this is my only activity:
public class HelloAndroidActivity extends RoboSherlockActivity { @InjectView(R.id.helloworld) TextView textView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView.setText("Roboguice says Hello World"); } }
Is there any correct way to create a basic project with these three elements using maven and Eclipse?
source share