我在maven项目上运行proguard遇到了一个问题。我有测试和发布版本的项目。发布版本号并混淆代码。当我在测试模式下运行我的android项目时,一切都很顺利,但是当我切换到释放模式时,异常被抛出。我的Maven版本是Maven 3.2.1, Android的mavenPlugin 3.6.0和Jdk 1.6
下面你可以看到我的项目的pom文件
http://maven.apache.org/maven-v4_0_0.xsd ">4.0.0SimpleTestMavenTest1.0快照apkMavenTestutf - 84.1.1.43.8.2
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.1.2_r4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>r10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
<dex>
<coreLibrary>true</coreLibrary>
</dex>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk
</outputApk>
</zipalign>
<manifest>
<debuggable>false</debuggable>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
<proguard>
<skip>false</skip>
<config>proguard.cfg</config>
<proguardJarPath>${proguard.jarpath}</proguardJarPath>
</proguard>
</configuration>
</plugin>
</plugins>
</build>
和错误:
执行目标com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:proguard (default-proguard)项目MavenTest: MojoExecutionException: ANDROID-040-001: Could not execute: Command =/bin/sh -c cd/home/git/mavenTest/MavenTest &&;/opt/oracle/jdk1.6.0_32/jre/bin/java -Xmx512M jar/opt/混淆器/proguard4.10/lib/proguard.jar @/home/git/mavenTest/mavenTest proguard.cfg -injars"/home/git/mavenTest/mavenTest/目标/类的-injars '/home/.m2/仓库/android/支持/compatibility-v4/r10/compatibility-v4-r10.jar (! meta - inf/maven/、! meta - inf/manifest . mf)的-libraryjars '/opt/oracle/jdk1.6.0_32/jre/lib/rt.jar -libraryjars '/opt/oracle/jdk1.6.0_32/jre/lib/jsse.jar -libraryjars '/opt/oracle/jdk1.6.0_32/jre/lib/jce.jar '-libraryjars"/home/.m2/仓库/com/google/android/android/4.1.1.4/android-4.1.1.4.jar (! org/xml/、! org/w3c/、! java/、! javax/)"-libraryjars"/home/.m2/仓库/通用日志/通用日志/1.1.1/commons-logging-1.1.1.jar -libraryjars的/home/.m2/仓库/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar -libraryjars的/home/.m2/仓库/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar -libraryjars'/home/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar' -libraryjars '/home/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar' -libraryjars '/home/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4 .jar' -libraryjars '/home/.m2/repository/org/json/json/20080701/json-20080701.jar' -libraryjars .jar' -libraryjars ./home/.m2/repository/org/json/json/20080701/json-20080701.jar' -libraryjars ./'/home/.m2/repository/android/android/4.1.2_r4/android-4.1.2_r4.jar(!org/xml/,!org/w3c/,!java/,!javax/**)' -outjars '/home/git/mavenTest/mavenTest/target/proguard/dump.txt' -printseeds '/home/git/mavenTest/mavenTest/target/proguard/seeds.txt' -printusage '/home/zjuroszek/git2/mavenTest/mavenTest/target/proguard/usagge .txt' -printmapping .jar' -printmapping .jar' -printmapping .jar'/home/zjuroszek/git2/mavenTest/mavenTest/target/proguard/mapping.txt', Result = 1 -> [Help 1]
你一定要先在maven上查看这个文档https://code.google.com/p/maven-android-plugin/wiki/GettingStarted