1
votes

I have got a problem with running proguard on maven project. I have test and release version of the project. Release version sign and obfuscate the code. When I run my android project in test mode everything goes well however when I switch to release mode exception is thrown. My Maven vesrion is Maven 3.2.1, Android mavenPlugin 3.6.0 and Jdk 1.6

Below you can see pom file from my project

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 SimpleTest MavenTest 1.0-SNAPSHOT apk MavenTest UTF-8 4.1.1.4 3.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>

and error :

Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:proguard (default-proguard) on project 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/proguard/proguard4.10/lib/proguard.jar @/home/git/mavenTest/MavenTest/proguard.cfg -injars '/home/git/mavenTest/MavenTest/target/classes' -injars '/home/.m2/repository/android/support/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/repository/com/google/android/android/4.1.1.4/android-4.1.1.4.jar(!org/xml/,!org/w3c/,!java/,!javax/)' -libraryjars '/home/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar' -libraryjars '/home/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar' -libraryjars '/home/.m2/repository/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/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.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.4c.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/MavenTest-1.0-SNAPSHOT_obfuscated.jar' -dump '/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/usage.txt' -printmapping '/home/zjuroszek/git2/mavenTest/MavenTest/target/proguard/mapping.txt', Result = 1 -> [Help 1]

1

1 Answers

0
votes

you definitely want to check this documentation on maven first https://code.google.com/p/maven-android-plugin/wiki/GettingStarted