1

This is my project structure in intellij:

enter image description here

and 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>P....</groupId> <artifactId>P...</artifactId> <version>1.0</version> <packaging>jar</packaging> <name>P...</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <version>4.1.1.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.actionbarsherlock</groupId> <artifactId>actionbarsherlock</artifactId> <version>4.4.0</version> <type>apklib</type> </dependency> <dependency> <groupId>net.lingala.zip4j</groupId> <artifactId>zip4j</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-webdav</artifactId> <version>2.5.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.8.0</version> <configuration> <sdk> <path>${env.ANDROID_HOME}</path> <platform>16</platform> </sdk> </configuration> </plugin> </plugins> </build> </project> 

and this is what i run for create an apk from my project:

enter image description here

everything is ok when i run my program inside emulator using intellij but when i try to create an apk, this error is shown from maven:

[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building P... 1.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- android-maven-plugin:3.8.0:apk (default-cli) @ P.... --- [INFO] Copying local assets files to combined assets directory. [INFO] Enabling debug build for apk. [INFO] C:\Users\...\android-sdk\build-tools\18.1.0\aapt.exe [package, -f, -M, D:\Projects\P....\AndroidManifest.xml, -S, D:\Projects\P....\res, --auto-add-overlay, -A, D:\Projects\P...\target\generated-sources\combined-assets\assets, -I, C:\Users\...\android-sdk\platforms\android-16\android.jar, -F, D:\Projects\P....\target\P....-1.0.ap_, --debug-mode] [INFO] D:\Projects\P....\res\values\styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light.DarkActionBar'. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.118s [INFO] Finished at: Sat Dec 14 11:23:35 IRST 2013 [INFO] Final Memory: 6M/13M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:apk (default-cli) on project P....: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "C:\Users\...\android-sdk\build-tools\18.1.0\aapt.exe package -f -M D:\Projects\P...\AndroidManifest.xml -S D:\Projects\P....\res --auto-add-overlay -A D:\Projects\P...\target\generated-sources\combined-assets\assets -I C:\Users\...\android-sdk\platforms\android-16\android.jar -F D:\Projects\P....\target\P...-1.0.ap_ --debug-mode", Result = 1 -> [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/MojoExecutionException 

what is wrong in my settings???

Edit:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.................." android:versionCode="1" android:versionName="1.0" > <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.USE_CREDENTIALS"/> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.READ_SYNC_STATS"/> <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/> <uses-permission android:name="android.permission.BROADCAST_STICKY"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.READ_SMS"/> <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CALL_LOG"/> <uses-permission android:name="android.permission.READ_CALENDAR"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name" android:exported="true" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE"/> </intent-filter> </activity> <activity android:name=".authentication.AuthenticateActivity"/> <activity android:name=".ui.activity.DisplayInfoActivity"/> <activity android:name=".ui.activity.Preferences"/> <activity android:name=".ui.activity.ParentActivity"/> </application> </manifest> 

and there is no theme. This is styles.xml:

<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Animations" /> <style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar"/> <style name="OAuthDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowNoTitle">false</item> </style> <color name="setup_text_hint">#777777</color> <color name="setup_text_typed">#000000</color> </resources> 
4
  • 1. why packaging is jar and no apk? 2. why you have imported the sherlock bar module since you have declared the dependency - and probably you use the local repository Commented Dec 14, 2013 at 9:48
  • 1. because of an error packaging must be jar. when i set it to apk another compile time error happens. 2. this is the instruction of using actionbarsherlock. because it has some resource files that needs to import project source and declare as dependency. Commented Dec 14, 2013 at 10:35
  • I said that everything is ok in emulator and project runs fine but i can not create apk! Commented Dec 14, 2013 at 10:35
  • First the packaging should be apk in order com.jayway.maven.plugins.android.generation2 works as expected Second there is not instruction to use both maven dependency & module you need to choose between two. I have already used Sherlock many times with only the maven dependency - without module import and everything works fine. Try to change the packaging to apk, remove Sherlock module - keep only the maven dependency Commented Dec 14, 2013 at 11:18

1 Answer 1

2

This is an working example maven-intellij-sherlock:

enter image description here

And the pom.xml is:

<parent> <groupId>.................</groupId> <artifactId>..........-parent</artifactId> <version>0.0.4</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>..........-android</artifactId> <packaging>apk</packaging> <name>.............| Android apk</name> <dependencies> <dependency> <groupId>com.actionbarsherlock</groupId> <artifactId>actionbarsherlock</artifactId> <type>apklib</type> <exclusions> <exclusion> <groupId>com.google.android</groupId> <artifactId>support-v4</artifactId> </exclusion> </exclusions> </dependency> </dependencies> 

edit:

<plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <extensions>true</extensions> <executions> <execution> <id>lint</id> <goals> <goal>lint</goal> </goals> <phase>package</phase> </execution> </executions> <configuration> <release>true</release> <sdk> <platform>${android.api.version}</platform> </sdk> <lint> <skip>false</skip> <failOnError>false</failOnError> </lint> <proguard> <skip>false</skip> <jvmArguments> <jvmArgument>-Xms1G</jvmArgument> <jvmArgument>-Xmx2G</jvmArgument> </jvmArguments> </proguard> </configuration> </plugin> 
Sign up to request clarification or add additional context in comments.

10 Comments

try the com.jayway.maven.plugins.android.generation2 plugin without version: check edit
and again: D:\Projects\...\res\values\styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light.DarkActionBar'.
So you have removed the module?
could you please post the AndroidManifest.xml and themes.xml (if any)?
Also post the @style/AppTheme configuration
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.