当前位置: 代码迷 >> Android >> android中的maven配备
  详细解决方案

android中的maven配备

热度:66   发布时间:2016-05-01 11:35:40.0
android中的maven配置

?

android 中配置maven中使用android-maven-plugin插件,配置详见

http://code.google.com/p/maven-android-plugin/w/list

?

注意问题:

?

?

?

1.android-maven-plugin的版本3.0.0混淆后的apk可能会无法运行;

?

?

?

?

2.项目比较大时会出现虚拟机内存不jvmArguments来设置虚拟机的参数;

?

?

?

?

?

?

?

下面是一实例:

?

?

?

?

?

<plugin>

? ? ? ? ?<groupId>com.jayway.maven.plugins.android.generation2</groupId>

?<artifactId>android-maven-plugin</artifactId>

?<version>3.4.1</version>

?<inherited>true</inherited>

?<extensions>true</extensions>

?<configuration>

?<sdk>

? ? ? ??<platform>8</platform>

? ? ? ??<path>${env.ANDROID_SDK}</path>

?</sdk>

?<dex>

?<jvmArguments>

?<jvmArgument>-Xms256m</jvmArgument>

?<jvmArgument>-Xmx512m</jvmArgument>

?</jvmArguments>

?</dex>

?<proguard>

?<skip>false</skip>

?</proguard>

?<zipalign>

?<skip>false</skip>

?<verbose>true</verbose>

?<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk>

?<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk

?

</outputApk>

?

?

</zipalign>

<aaptExtraArgs>${android.aaptExtraArgs}</aaptExtraArgs>

<resourceDirectory>${project.basedir}/res</resourceDirectory>

</configuration>

<executions>

<execution>

<id>alignApk</id>

<phase>package</phase>

<goals>

<goal>zipalign</goal>

</goals>

</execution>

</executions>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-jarsigner-plugin</artifactId>

<version>1.2</version>

<executions>

<execution>

<id>signing</id>

<goals>

<goal>sign</goal>

<goal>verify</goal>

</goals>

<phase>package</phase>

<inherited>true</inherited>

<configuration>

<archiveDirectory />

<removeExistingSignatures>true</removeExistingSignatures>

<includes>

<include>${project.build.directory}/${project.artifactId}.apk</include>

</includes>

<keystore>${keyFilePath}</keystore>

<storepass>${storePassword}</storepass>

<alias>${keyAlias}</alias>

<verbose>true</verbose>

</configuration>

</execution>

</executions>

</plugin>

?

?

  相关解决方案