library classes cannot be resolved

266 views
Skip to first unread message

daniela

unread,
Jun 8, 2011, 8:17:37 AM6/8/11
to Maven Android Developers
Hi,

I am trying to run the ApkLib samples provided with the plugin
(libraryprojects) and I get an
org.apache.maven.plugin.MojoExecutionException:


com.jayway.maven.plugins.android.generation2.samples.libraryprojects.lib1
cannot be resolved MainActivity.java /libraryprojects-mainapp/src/main/
java/com/jayway/maven/plugins/android/generation2/samples/
libraryprojects/mainapp line 6 Java Problem

[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
at
com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:
432)
at
com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:
141)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:
101)
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: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: com.jayway.maven.plugins.android.ExecutionException:
ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:
\Program Files\Android\android-sdk\platform-tools\aapt.exe" package -m
-J C:\Users\DA185070\workspace\jayway-maven-android-plugin-samples-
b48a233\libraryprojects\libraryprojects-mainapp\target\generated-
sources\r -M C:\Users\DA185070\workspace\jayway-maven-android-plugin-
samples-b48a233\libraryprojects\libraryprojects-mainapp
\AndroidManifest.xml -S C:\Users\DA185070\workspace\jayway-maven-
android-plugin-samples-b48a233\libraryprojects\libraryprojects-mainapp
\res -S C:\Users\DA185070\workspace\jayway-maven-android-plugin-
samples-b48a233\libraryprojects\libraryprojects-mainapp\target\unpack
\apklibs/
com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-
lib1_apklib_1.0.0-SNAPSHOT/res -S C:\Users\DA185070\workspace\jayway-
maven-android-plugin-samples-b48a233\libraryprojects\libraryprojects-
mainapp\target\unpack\apklibs/
com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-
lib2_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -I "C:\Program Files
\Android\android-sdk\platforms\android-9\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:
430)
... 22 more
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1.948s
[INFO] Finished at: Wed Jun 08 13:03:51 BST 2011
[INFO] Final Memory: 6M/15M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
com.jayway.maven.plugins.android.generation2:maven-android-plugin:
3.0.0-SNAPSHOT:generate-sources (default-generate-sources) on project
libraryprojects-mainapp: MojoExecutionException: ANDROID-040-001:
Could not execute: Command = cmd.exe /X /C ""C:\Program Files\Android
\android-sdk\platform-tools\aapt.exe" package -m -J C:\Users
\DA185070\workspace\jayway-maven-android-plugin-samples-
b48a233\libraryprojects\libraryprojects-mainapp\target\generated-
sources\r -M C:\Users\DA185070\workspace\jayway-maven-android-plugin-
samples-b48a233\libraryprojects\libraryprojects-mainapp
\AndroidManifest.xml -S C:\Users\DA185070\workspace\jayway-maven-
android-plugin-samples-b48a233\libraryprojects\libraryprojects-mainapp
\res -S C:\Users\DA185070\workspace\jayway-maven-android-plugin-
samples-b48a233\libraryprojects\libraryprojects-mainapp\target\unpack
\apklibs/
com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-
lib1_apklib_1.0.0-SNAPSHOT/res -S C:\Users\DA185070\workspace\jayway-
maven-android-plugin-samples-b48a233\libraryprojects\libraryprojects-
mainapp\target\unpack\apklibs/
com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-
lib2_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -I "C:\Program Files
\Android\android-sdk\platforms\android-9\android.jar"", 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

I've tried using the latest snapshot as explained here:
http://groups.google.com/group/maven-android-developers/browse_thread/thread/469d3413ab72b042,
but that had no effect.

Could you please give me any pointers to what might be wrong?
I'm using eclipse Helios with the latest version of the Android SDK
and Java SE 6 update 26.

Please accept my apologies if this a noob question.

Thanks!

hjrnunes

unread,
Jun 8, 2011, 8:35:15 AM6/8/11
to Maven Android Developers
Hi Daniela!

Take a better look at the final messages in the thread you mentioned.
Although I did build the latest snapshot at the time, I later found
the problem to be an incorrect folder structure in an Apklib I had
installed in my repository.

Your problem is probably similar... What is happening is that maven is
trying to run a command on your system, and it's failing. You need to
check why it is failing.

I'd recommend looking at the command carefully and try to make sure
the paths are ok (you're on Windows, which has different path syntax,
I'm not sure how maven deals with it).
Also, if you've installed any apklib (with mvn install:install-file)
make sure the folder structure is the right one. See the thread you
already found for details.

Also, it might help to try to run the command for yourself in your
project folder. I think maven leaves the build process where it failed
so you can manually run the command and get a more descriptive error
message. And try "mvn -X clean install" to get full error
descriptions. In my case, an [INFO] log entry before the actual error
hinted about missing folders which led me to the actual cause of the
error.

Anyway, what I can tell you is that it is probably a very simple issue
to solve, albeit a perhaps no so simple one to identify. But it's got
more to do with your project setup than with the maven-android-plugin
version.

Good luck,
Henrique
> lib2_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -I "C:\Program Files
> \Android\android-sdk\platforms\android-9\android.jar"", 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
>
> I've tried using the latest snapshot as explained here:http://groups.google.com/group/maven-android-developers/browse_thread...,

daniela

unread,
Jun 8, 2011, 11:20:23 AM6/8/11
to Maven Android Developers
Thanks, Henrique :)
Reply all
Reply to author
Forward
0 new messages