Using proguard in profile

300 views
Skip to first unread message

siliconeagle

unread,
Dec 3, 2011, 5:57:38 PM12/3/11
to Maven Android Developers
I am trying to configure a 'release' profile using proguard which I
had working using an older version of the plugin and I am trying to
update it to the latest version. I uses some apk-libraries in the
structure: CommonViewsLibrary < DrawViewLibrary < DrawCards

Have been trying it a few different ways, but when i get to the error:

[proguard] Reading input...
[proguard] java.io.IOException: The input doesn't contain any
classes. Did you specify the proper '-injars' options?

I am not sure what to do - I am not sure how the input classes should
be specified. Guess its probably some elementary maven thing, but I
cant find it...

The files are below :
------------------------------------------------------------------
pom.xml
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>co.uk.sentinelweb.cards</groupId>
<artifactId>DrawCards</artifactId>
<version>0.8</version>
<packaging>apk</packaging>
<name>DrawCards</name>

<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<!-- add a dep for the ad library -->
<dependency>
<groupId>com.millennialmedia.android</groupId>
<artifactId>mmadview</artifactId>
<version>4.5</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>co.uk.sentinelweb.commonlibs</groupId>
<artifactId>CommonsViewsLibrary</artifactId>
<version>1.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>co.uk.sentinelweb.views.draw</groupId>
<artifactId>DrawViewLibrary</artifactId>
<version>1.0</version>
<type>apklib</type>
</dependency>
</dependencies>

<properties>
<maven.build.timestamp.format>yyDDDHH</maven.build.timestamp.format>
<versionCode>${maven.build.timestamp}</versionCode>
<releaseApkArchivePath>${project.build.directory}</
releaseApkArchivePath>
<rt.jar.path>${env.JAVA_HOME}/jre/lib/rt.jar</rt.jar.path>
<jsse.jar.path>${env.JAVA_HOME}/jre/lib/jsse.jar</jsse.jar.path>
</properties>

<build>
<!--<finalName>${project.artifactId}</finalName> -->
<sourceDirectory>${project.build.directory}/src</sourceDirectory>

<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<sourceDirectory>${project.build.directory}/src</sourceDirectory>
<androidManifestFile>${project.build.directory}/
AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.build.directory}/res</
resourceDirectory>
<libDirectory>${project.basedir}/lib</libDirectory>
<sdk>
<path>/home/robert/bin/android-sdk-linux_x86</path>
<platform>11</platform>
</sdk>
<!-- <customPackage>co.uk.sentinelweb.silenttimer</customPackage>
-->
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<zipalign>
<verbose>true</verbose>
<skip>false</skip>
<inputApk>${project.build.directory}/${project.artifactId}-$
{project.version}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}_v$
{versionString}_${vendor}_z.apk</outputApk>
</zipalign>
<sign>
<debug>false</debug>
</sign>
</configuration>

<extensions>true</extensions>
<executions>
<execution>
<id>zipalign</id>
<phase>verify</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</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>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<includes>
<include>${project.build.directory}/${project.artifactId}-$
{project.version}.apk</include>
</includes>
<keystore>${keystore.location}</keystore>
<storepass>${keystore.password}</storepass>
<keypass>${keystore.keypass}</keypass>
<alias>${keystore.alias}</alias>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- default resources -->
<resources>
<resource>
<filtering>false</filtering>
<directory>${basedir}</directory>
<includes>
<include>AndroidManifest.xml</include>
</includes>
<targetPath>${project.build.directory}</targetPath>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src</directory>
<targetPath>${project.build.directory}/src</targetPath>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/res</directory>
<targetPath>${project.build.directory}/res</targetPath>
</resource>
</resources>
</build>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<versionString>${project.version}.norelease</versionString>
<vendor>NORELEASE</vendor>
<versionCode>${buildNumber}</versionCode>
</properties>
</profile>

<profile>
<id>release</id>
<!-- via this activation the profile is automatically used when the
release
is done with the maven release plugin -->
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<injar>android-classes</injar>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<obfuscate>true</obfuscate>
<options>
<option>@proguard.cfg</option>
</options>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
-------------------------------------------------------------------------------------------
proguard.cfg ----------------------------------------------------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose

-keep public class com.millennialmedia.android.**
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet,
int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
----------------------------------------------------------------------------------------
output -----------------------------------------------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose

-keep public class com.millennialmedia.android.**
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet,
int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

Roberto

unread,
Dec 4, 2011, 4:11:30 AM12/4/11
to maven-androi...@googlegroups.com
This looks like the same ProGuard regression I encountered while upgrading from 3.0.0-alpha-14 to 3.0.0 final - issue reported here:


For the time being you could revert back to 3.0.0-alpha-14 which should solve your problems.

Roberto

siliconeagle

unread,
Dec 4, 2011, 6:12:22 AM12/4/11
to Maven Android Developers
awesome. that works. thanks.
Reply all
Reply to author
Forward
0 new messages