问题
(After really many hours trying it, I finally resign.)
Alright:
-1. I do
mvn -X archetype:generate -DarchetypeArtifactId=android-release
-DarchetypeGroupId=de.akquinet.android.archetypes -DarchetypeVersion=1.0.9
-DgroupId=org.me -DartifactId=myAndroidApp -Demulator=myEmu
-Dplatform=10
-2. First issue: you must manually edit top-level pom.xml to add
< properties>
< platform.version> 2.3.3 < /platform.version>
< /properties>
despite it is a straightforward relationship between -Dplatform=10
and 2.3.3
-3. (possibly) Second issue (instrumentation tests: myAndroidApp-it dir.)
You have to edit AndroidManifest.xml and check whether the android:targetPackage
value
is right
-4. Third issue (which I couldn't be able to resolve). Problems with zipaligned-classifier dependencies in the instrumentation tests (myAndroidApp-it dir.)
When doing mvn install
-4.1
[WARNING] The POM for org.me:myAndroidApp:apk:${zipaligned-classifier}:1.0-SNAPSHOT
is missing, no dependency information available
[WARNING] The POM for org.me:myAndroidApp:jar:1.0-SNAPSHOT
is missing, no dependency information available
-4.2
[ERROR] Failed to execute goal on project myAndroidApp-it:
Could not resolve dependencies for
project org.me:myAndroidApp-it:apk:1.0-SNAPSHOT:
The following artifacts could not be resolved:
org.me:myAndroidApp:apk:${zipaligned-classifier}:1.0-SNAPSHOT, org.me:myAndroidApp:jar:1.0-SNAPSHOT:
Could not find artifact org.me:myAndroidApp:apk:${zipaligned-classifier}:1.0-
Thanks
Update: reported the issue here
回答1:
I thing adding this in your <Properties>
section may fix the first warning:
<zipaligned-classifier>aligned</zipaligned-classifier>
Then run mvn install in your myAndroidApp project. Ensure the build is successful for your app (don't care you myAndroidApp-it for now), and then take a look to your local repo to see the artifacts that where installed. (<USER_HOME>/.m2/repository/org/me
)
For your second warning : ensure you have something like this in dependencies of myAndroidApp-it:
<dependency>
<groupId>org.me</groupId>
<artifactId>myAndroidApp</artifactId>
<type>apk</type>
<version>1.0-SNAPSHOT</version>
<dependency>
Depending on the artifacts that where installed you may need to add a classifier for this dependency (since you didn't post your pom.xml it's difficult to say what will be installed by mvn).
<dependency>
<groupId>org.me</groupId>
<artifactId>myAndroidApp</artifactId>
<type>apk</type>
<classifier>${zipaligned-classifier}</classfier>
<version>1.0-SNAPSHOT</version>
<dependency>
来源:https://stackoverflow.com/questions/14424569/issues-with-android-maven-plugin