I am trying to build my Android project with Maven so I could automate my tests, but I'm getting the following error:
D:\Projects\mtproject>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AppScience 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-android-plugin:2.8.4:generate-sources (default-generate-sources) @ appsci
ence ---
[INFO] ANDROID-904-002: Found aidl files: Count = 3
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Copying local resource files to combined resource directory.
[INFO] C:\Program Files (x86)\Android\android-sdk/platform-tools/aapt.exe [package, -m, -J
, D:\Projects\mtproject\target\generated-sources\r, -M, D:\Projects\mtproject\AndroidManif
est.xml, -S, D:\Projects\mtproject\target\generated-sources\combined-resources\res, -A, D:
\Projects\mtproject\assets, -I, C:\Program Files (x86)\Android\android-sdk\platforms\andro
id-4\android.jar]
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\main.x
ml:2: error: Error: String types not allowed (at 'layout_height' with value 'match_parent'
).
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\main.x
ml:2: error: Error: String types not allowed (at 'layout_width' with value 'match_parent')
.
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\main.x
ml:5: error: Error: String types not allowed (at 'layout_width' with value 'match_parent')
.
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\main.x
ml:11: error: Error: String types not allowed (at 'layout_width' with value 'match_parent'
).
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\splash
.xml:2: error: Error: String types not allowed (at 'layout_width' with value 'match_parent
').
[INFO] D:\Projects\mtproject\target\generated-sources\combined-resources\res\layout\splash
.xml:2: error: Error: String types not allowed (at 'layout_height' with value 'match_paren
t').
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.gen
erateR(GenerateSourcesMojo.java:313)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.exe
cute(GenerateSourcesMojo.java:111)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPlugi
nManager.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(Lifecyc
leModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Lifecyc
leModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(Lifecy
cleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.j
ava: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.ja
va: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.jav
a: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 (x86)\Android\android-sdk\platform-to
ols\aapt.exe" package -m -J D:\Projects\mtproject\target\generated-sources\r -M D:\Project
s\mtproject\AndroidManifest.xml -S D:\Projects\mtproject\target\generated-sources\combined
-resources\res -A D:\Projects\mtproject\assets -I "C:\Program Files (x86)\Android\android-
sdk\platforms\android-4\android.jar"", Result = 1
at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(Comma
ndExecutor.java:186)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.gen
erateR(GenerateSourcesMojo.java:311)
... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.558s
[INFO] Finished at: Fri Aug 26 04:00:16 CEST 2011
[INFO] Final Memory: 7M/45M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-
plugin:2.8.4:generate-sources (default-generate-sources) on project appscience: MojoExecut
ionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Program Fil
es (x86)\Android\android-sdk\platform-tools\aapt.exe" package -m -J D:\Projects\mtproject\
target\generated-sources\r -M D:\Projects\mtproject\AndroidManifest.xml -S D:\Projects\mtp
roject\target\generated-sources\combined-resources\res -A D:\Projects\mtproject\assets -I
"C:\Program Files (x86)\Android\android-sdk\platforms\android-4\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 sol开发者_如何学编程utions, please read the foll
owing articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I can't figure out what the error is!
Thanks a lot everybody in advance!
OK I got it: it was a configuration problem with the pom.xml:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
...................
<configuration>
<sdk>
<platform>17</platform>
</sdk>
</configuration>
............
Just make sure you choose the right SDK version there.
The value match_parent
is not valid value for earlier versions than Android SDK 1.6 (I was having a <platform>4</platform>
).
精彩评论