Cxyushi / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

proguard: -assumenosideeffects having no effect #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.This in my pom.xml for the proguard plugin:
            <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.4</version>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard</artifactId>
                        <version>4.5.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <injar>android-classes</injar>
                    <proguardVersion>4.5.1</proguardVersion>
                    <libs>
                        <lib>${java.home}/lib/rt.jar</lib>
                    </libs>
                    <obfuscate>false</obfuscate>
                    <options>
                        <option>-keep public
                            class * extends android.app.Activity</option>
                        <option>-keep public
                            class * extends android.app.Application</option>
                        <option>-keep
                            public class * extends android.app.Service</option>
                        <option>-keep
                            public class * extends android.content.ContentProvider</option>
                        <option>-keep public class * extends android.content.BroadcastReceiver</option>

<option>-assumenosideeffects class android.util.Log {
                            public static *** d(...);
                        } </option>
                        <option>-assumenosideeffects class android.util.Log {
                            public static *** v(...);
                        } </option>
                        <option>-adaptresourcefilenames **.properties,**.xml,**.png</option>
                        <option>-dontpreverify</option>
                        <option>-dontskipnonpubliclibraryclasses</option>
<option>-target 1.6</option>
<option>-dontoptimize</option>
<option>-keepattributes *Annotation*</option>
<option>-ignorewarnings</option>
<option>-printmapping map.txt</option>
<option>-printusage unused.txt</option>
<option>-printseeds seed.txt</option>
</options>
                </configuration>
            </plugin>

2. mvn install -Psign
3.

What is the expected output?
no debug or verbose logging viewed from DDMS console in Eclipse

What do you see instead?
debug and verbose logging viewed from DDMS console in Eclipse

What version of maven-android-plugin are you using?
2.8.3

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 2.2.1 (r801777; 2009-08-06 13:16:01-0600)
Java version: 1.6.0_22
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.5" arch: "x86_64" Family: "mac"

Please provide any additional information below.
I've followed the steps on the wiki succesfully.  I've tried using the proguard 
2.3 and 2.5.1 jars -- successfully getting them to process the classes but 
still get the logging.

Original issue reported on code.google.com by fbeach...@gmail.com on 10 Dec 2010 at 9:29

GoogleCodeExporter commented 9 years ago
Thats actually a proguard configuration issue and not an issue with the maven 
android plugin. Maybe ask on the proguard mailinglist or forum about that.

Original comment by mosa...@gmail.com on 11 Dec 2010 at 5:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks to Manfred Moser I've gotten this working.  No more logging in the 
release builds, and an improved build overall.  I've followed his example at 
https://github.com/mosabua/maven-android-plugin-samples/tree/master/morseflash. 
 I refactored the project and its instrumentation to use the same hierarchy as 
Moser in order to leverage the maven profiles he wrote.  I basically have it 
working out-of-the-box, but there's a minor tweak I'm fiddling with to use 
Eclipse alongside, and the "filtered-resources" concept is creating a little 
quirkiness in the build.  Aside from that it's pretty golden.

Now that I refactored the project, the POM sample in this report doesn't apply 
anymore.  I'll leave it for another person to figure out how to take the sample 
(which originally comes from the example(s) in the android-maven-plugin 
project) and get "-assumenosideeffects" to work.  I adopted the new setup 
because I've seen similar setups in other open-source projects, and my projects 
were in a position to be easily migrated.  It's turned out better than figuring 
out how to get the same Proguard options in 
https://github.com/mosabua/maven-android-plugin-samples/tree/master/morseflash/m
orseflash-app/pom.xml to work in my pom.

Original comment by fbeach...@gmail.com on 18 Dec 2010 at 10:11

GoogleCodeExporter commented 9 years ago
I will close this issue since there is a solution as commented. PS: Manfred 
Moser == mosabua ;-)

Original comment by mosa...@gmail.com on 18 Jan 2011 at 5:35

GoogleCodeExporter commented 9 years ago

Original comment by mosa...@gmail.com on 18 Jan 2011 at 5:36

GoogleCodeExporter commented 9 years ago
Just a hint here: use a proguard.cfg file instead of embedding the proguard 
configuration on the pom.xml.

Original comment by Martin.K...@gmail.com on 20 Jun 2011 at 7:41