Android Maven : LifecycleExecutionException - android

This is the stack trace of the error which Is thrown when I do mvn install :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.511s
[INFO] Finished at: Fri Jun 15 10:20:12 EDT 2012
[INFO] Final Memory: 14M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:dex (default-dex) on project dp-marketplace: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/dev/Workspace/App/dp-marketplace-android.git && /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx1024M -jar /Users/dev/Workspace/android-sdk-macosx/platform-tools/lib/dx.jar --dex --output=/Users/dev/Workspace/App/dp-marketplace-android.git/target/classes.dex /Users/dev/.m2/repository/org/ektorp/org.ektorp.android/1.3.1-SNAPSHOT/org.ektorp.android-1.3.1-SNAPSHOT.jar /Users/dev/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar /Users/dev/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar /Users/dev/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar /Users/dev/.m2/repository/com/actionbarsherlock/library/4.1.0/library-4.1.0.apklib /Users/dev/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar /Users/dev/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar /Users/dev/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar /Users/dev/.m2/repository/com/google/android/android/4.0.1.2/android-4.0.1.2.jar /Users/dev/.m2/repository/org/ektorp/org.ektorp/1.3.1-SNAPSHOT/org.ektorp-1.3.1-SNAPSHOT.jar /Users/dev/Workspace/App/dp-marketplace-android.git/target/classes /Users/dev/.m2/repository/org/apache/commons/commons-lang3/3.0.1/commons-lang3-3.0.1.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar /Users/dev/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar /Users/dev/.m2/repository/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar /Users/dev/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.7/jackson-core-asl-1.9.7.jar /Users/dev/.m2/repository/org/json/json/20080701/json-20080701.jar /Users/dev/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar /Users/dev/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /Users/dev/.m2/repository/com/couchbase/android/couchbase-dp/2.0.0-31/couchbase-dp-2.0.0-31.jar /Users/dev/.m2/repository/com/google/android/support-v4/r7/support-v4-r7.jar /Users/dev/.m2/repository/com/couchbase/android/OtpErlang/r14b03/OtpErlang-r14b03.jar /Users/dev/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.7/jackson-mapper-asl-1.9.7.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpclient-cache/4.1.2/httpclient-cache-4.1.2.jar /Users/dev/.m2/repository/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar /Users/dev/.m2/repository/com/comp/press/dp-android-library/0.1-SNAPSHOT/dp-android-library-0.1-SNAPSHOT.apklib /Users/dev/.m2/repository/com/comp/couch-transfer/1.0-SNAPSHOT/couch-transfer-1.0-SNAPSHOT.jar, Result = 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:dex (default-dex) on project dp-marketplace:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException:
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.runDex(DexMojo.java:232)
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.execute(DexMojo.java:116)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/dev/Workspace/App/dp-marketplace-android.git && /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx1024M -jar /Users/dev/Workspace/android-sdk-macosx/platform-tools/lib/dx.jar --dex --output=/Users/dev/Workspace/App/dp-marketplace-android.git/target/classes.dex /Users/dev/.m2/repository/org/ektorp/org.ektorp.android/1.3.1-SNAPSHOT/org.ektorp.android-1.3.1-SNAPSHOT.jar /Users/dev/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar /Users/dev/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar /Users/dev/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar /Users/dev/.m2/repository/com/actionbarsherlock/library/4.1.0/library-4.1.0.apklib /Users/dev/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar /Users/dev/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar /Users/dev/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar /Users/dev/.m2/repository/com/google/android/android/4.0.1.2/android-4.0.1.2.jar /Users/dev/.m2/repository/org/ektorp/org.ektorp/1.3.1-SNAPSHOT/org.ektorp-1.3.1-SNAPSHOT.jar /Users/dev/Workspace/App/dp-marketplace-android.git/target/classes /Users/dev/.m2/repository/org/apache/commons/commons-lang3/3.0.1/commons-lang3-3.0.1.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar /Users/dev/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar /Users/dev/.m2/repository/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar /Users/dev/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.7/jackson-core-asl-1.9.7.jar /Users/dev/.m2/repository/org/json/json/20080701/json-20080701.jar /Users/dev/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar /Users/dev/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /Users/dev/.m2/repository/com/couchbase/android/couchbase-dp/2.0.0-31/couchbase-dp-2.0.0-31.jar /Users/dev/.m2/repository/com/google/android/support-v4/r7/support-v4-r7.jar /Users/dev/.m2/repository/com/couchbase/android/OtpErlang/r14b03/OtpErlang-r14b03.jar /Users/dev/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.7/jackson-mapper-asl-1.9.7.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpclient-cache/4.1.2/httpclient-cache-4.1.2.jar /Users/dev/.m2/repository/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar /Users/dev/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar /Users/dev/.m2/repository/com/comp/press/dp-android-library/0.1-SNAPSHOT/dp-android-library-0.1-SNAPSHOT.apklib /Users/dev/.m2/repository/com/comp/couch-transfer/1.0-SNAPSHOT/couch-transfer-1.0-SNAPSHOT.jar, Result = 1
at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:215)
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.runDex(DexMojo.java:230)
... 22 more
[ERROR]
[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
I am fairly new to maven and I am not sure what exactly is the problem. Anyone has any suggestions as to how I should proceed to fix this issue?

Hmmm.. The android dependency should have a provided scope.. Adding a <scope>provided</scope> solved the problem..

Related

Phonegap Build Error: Execution failed for task ':transformClassesWithDexForRelease'

I'm having BUILD FAILED everytime I try to build using phonegap build android --release. Here's what I get by adding --verbose,
BUILD FAILED
Total time: 5.791 secs
Command finished with error code 1: cmd /s /c ""D:\Phonegap Projects\Project - GAMEHOBEY\GameHobe-final\platforms\android\gradlew.bat" cdvBuildRelease -b "D:\Phonegap Projects\Project - GAMEHOBEY\GameHobe-final\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true"
(node:3344) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:775)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741)
at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:695)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
at com.android.dx.command.dexer.Main.run(Main.java:292)
at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:787)
at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)
at com.android.dx.command.dexer.Main.processClass(Main.java:773)
... 16 more
1 error; aborting
I'm not sure how can I fix this.

Error in Android bootstrap?

Hello every one I am working on android boot strap for that I follow this link and I configure Maven on my linux machine. I also use Intellij for Android but I have some error.
error which I am getting when I try Maven command in my Android bootstrap project :
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) # com-example-demo-parent ---
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Sep 07, 2013 4:33:51 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: org.apache.maven.plugin.clean.CleanMojo
java.lang.NoClassDefFoundError: org/apache/maven/shared/model/fileset/FileSet
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
at java.lang.Class.getDeclaredConstructors(Class.java:1855)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:98)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:831)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:758)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:255)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:204)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:954)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:987)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:950)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.model.fileset.FileSet
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 54 more
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] demo parent ....................................... FAILURE [0.248s]
[INFO] demo app .......................................... SKIPPED
[INFO] Android-Bootstrap integration tests ............... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.483s
[INFO] Finished at: Sat Sep 07 16:33:52 IST 2013
[INFO] Final Memory: 7M/86M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.3:clean (default-clean) on project com-example-demo-parent: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.3:clean failed: A required class was missing while executing org.apache.maven.plugins:maven-clean-plugin:2.3:clean: org/apache/maven/shared/model/fileset/FileSet
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-clean-plugin:2.3
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/trainee02/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.3/maven-clean-plugin-2.3.jar
[ERROR] urls[1] = file:/home/trainee02/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.maven.shared.model.fileset.FileSet
[ERROR] -> [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/PluginContainerException
error in my intellij project
please help . Thanx in advance .
well i find my answer after find lots of thing on he google is that . i change following settings:
my environment setting
export M2_HOME=/home/wideand04/mavehome/apache-maven-3.0.4
export PATH=/home/wideand04/mavehome/apache-maven-3.0.4/bin:${PATH}
and i use mave 3.0.4 binary and i get my solution thanks shiju B your link help me a lot
I had a similar problem when doing maven clean.
it was using maven-clean-plugin version 2.2 by default.
i forced version 2.5 by adding the following to my build and that solved the problem:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>

android-maven-plugin running instrumentation tests failing with NoClassDefFoundError

I'm running this:
mvn clean install -Psign --debug
building, signing, etc all works fine (and the test build can find the app build, the app build installs, the test build installs, it can communicate with the device, etc.)
[INFO] SH175T502423_HTC_HTCSensation4G : Running tests for specified test classes/methods: [com.myapp.app.test.RegistrationActivityTestCase]
[INFO] SH175T502423_HTC_HTCSensation4G : Running instrumentation tests in com.myapp.app.test
[INFO] SH175T502423_HTC_HTCSensation4G : Run started: com.myapp.app.test, 1 tests:
[INFO] SH175T502423_HTC_HTCSensation4G : Start [1/1]: junit.framework.TestSuite$1#warning
[INFO] SH175T502423_HTC_HTCSensation4G : FAILURE:junit.framework.TestSuite$1#warning
[INFO] SH175T502423_HTC_HTCSensation4G : junit.framework.AssertionFailedError: Exception in constructor: testButtonVisibility (java.lang.NoClassDefFoundError: com.myapp.app.RegistrationActivity
at com.myapp.app.test.RegistrationActivityTestCase.<init>(RegistrationActivityTestCase.java:15)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:103)
at android.test.AndroidTestRunner.getTest(AndroidTestRunner.java:127)
at android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:55)
at android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:80)
at android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:426)
at android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:407)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:362)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4424)
at android.app.ActivityThread.access$1300(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1677)
[INFO] SH175T502423_HTC_HTCSensation4G : End [1/1]: junit.framework.TestSuite$1#warning
[INFO] SH175T502423_HTC_HTCSensation4G : Run ended: 10 ms
[ERROR] SH175T502423_HTC_HTCSensation4G : FAILURES!!!
[INFO] Tests run: 1, Failures: 1, Errors: 0
[INFO] SH175T502423_HTC_HTCSensation4G : Report file written to C:\workspace\android\myappTest\target\surefire-reports\TEST-SH175T502423_HTC_HTCSensation4G.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:07.996s
[INFO] Finished at: Mon Jun 24 11:42:17 EDT 2013
[INFO] Final Memory: 22M/251M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:internal-integration-test (default-internal-integration-test) on project ecmobile-test: SH175T502423_HTC_HTCSensation4G : Tests failed on device. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:internal-integration-test (default-internal-integration-test) on project ecmobile-test: SH175T502423_HTC_HTCSensation4G : Tests failed on device.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: SH175T502423_HTC_HTCSensation4G : Tests failed on device.
at com.jayway.maven.plugins.android.AbstractInstrumentationMojo$1.doWithDevice(AbstractInstrumentationMojo.java:407)
at com.jayway.maven.plugins.android.ScreenshotServiceWrapper.doWithDevice(ScreenshotServiceWrapper.java:56)
at com.jayway.maven.plugins.android.AbstractAndroidMojo$2.runDo(AbstractAndroidMojo.java:764)
at com.jayway.maven.plugins.android.AbstractAndroidMojo$DoThread.run(AbstractAndroidMojo.java:1275)
I've done my best to mirror everything about the morseflash example (https://github.com/jayway/maven-android-plugin-samples/tree/master/morseflash), but still can't figure this out.
I'm hoping someone else can help!

Tried to Add Library, but with Gradlew Clean: Build Fails in Android Studio

I'm new to Android Studio and intelliJ. I'm trying to add a library. I put the .jar in the libs folder, and added
compile files('libs/achartengine-1.0.0.jar', 'libs/jsoup-1.7.2.jar')
to build.gradle. And I tried navigating in terminal to my project folder and running
gradlew clean
but I got:
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file '/Users/myname/Documents/workspace/myproject/build.gradle'.
Included projects: [root project 'myproject']
Evaluating root project 'myproject' using build file '/Users/myname/Documents/workspace/myproject/build.gradle'.
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
org.gradle.listener.ListenerNotificationException: Failed to notify project evaluation listener.
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
at org.gradle.configuration.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:465)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:76)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.lang.NullPointerException
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createGroovyObjectGetPropertySite(AbstractCallSite.java:254)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.acceptGroovyObjectGetProperty(AbstractCallSite.java:239)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at com.android.build.gradle.BasePlugin.resolveDependencyForConfig(BasePlugin.groovy:1211)
at com.android.build.gradle.BasePlugin$resolveDependencyForConfig.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at com.android.build.gradle.BasePlugin.resolveDependencies(BasePlugin.groovy:1164)
at com.android.build.gradle.BasePlugin$resolveDependencies.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at com.android.build.gradle.AppPlugin.doCreateAndroidTasks(AppPlugin.groovy:196)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)
at com.android.build.gradle.BasePlugin$_apply_closure1.doCall(BasePlugin.groovy:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at groovy.lang.Closure.call(Closure.java:412)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)
... 41 more
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/myname/Documents/workspace/myproject/build.gradle' line: 10
* What went wrong:
A problem occurred evaluating root project 'myproject'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
But I thought I set the paths correctly; the project runs find until I try to use the added library (the app crashes, of course). Here's the relevant part of my .profile
export ANDROID_SDK="<Downloads/android-sdk-macosx/platform-tools>"
export ANDROID_NDK="<Downloads/android-ndk-r8b>"
export ANDROID_HOME="<Downloads/android-sdk-macosx>"
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"
Any help would be appreciated.
Edit: changed path as suggested in answer below. Problem persists. More error info added as requested.
I finally fixed it. Altering the ANDROID_HOME didn't work. Instead I created a local.properities file in my project's directory and added
sdk.dir=/Users/myname/Downloads/android-sdk-macosx --- my path to the android sdk
then I could gradlew clean. Now AS can find my library and my app works.
It doesn't look like ANDROID_HOME is set right. You need to set it to wherever your SDK resides (it would appear to be Downloads/android-sdks).

Android ActionBar causing build-error (No resource found)

Tried a sample-project with johannilssons android-actionbar plugin and it worked fine. Tried it on another project and got this error. Thoughts on how to proceed in locating the source of the error?
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building HSR Android Frontend 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-android-plugin:2.8.4:generate-sources (default-generate-sources) # frontend-module ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Copying local resource files to combined resource directory.
[INFO] C:\Google\android-sdk-windows/platform-tools/aapt.exe [package, -m, -J, C:\Users\Love\workspace\HSR\HSR\frontend-module\target\generated-sources\r, -M, C:\Users\Love\workspace\HSR\HSR\frontend-module\AndroidManifest.xml, -S, C:\Users\Love\workspace\HSR\HSR\frontend-module\target\generated-sources\combined-resources\res, -I, C:\Google\android-sdk-windows\platforms\android-7\android.jar]
[INFO] C:\Users\Love\workspace\HSR\HSR\frontend-module\target\generated-sources\combined-resources\res\layout\main.xml:18: error: Error: No resource found that matches the given name (at 'style' with value '#style/ActionBar').
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:313)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:111)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "C:\Google\android-sdk-windows\platform-tools\aapt.exe package -m -J C:\Users\Love\workspace\HSR\HSR\frontend-module\target\generated-sources\r -M C:\Users\Love\workspace\HSR\HSR\frontend-module\AndroidManifest.xml -S C:\Users\Love\workspace\HSR\HSR\frontend-module\target\generated-sources\combined-resources\res -I C:\Google\android-sdk-windows\platforms\android-7\android.jar", Result = 1
at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:186)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:311)
... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Make sure your res/values/styles.xml has the ActionBar style in it.

Categories

Resources