Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emma instrumentation does not work when Proguard is enabled #489

Closed
deadmoto opened this issue Oct 23, 2014 · 5 comments
Closed

Emma instrumentation does not work when Proguard is enabled #489

deadmoto opened this issue Oct 23, 2014 · 5 comments

Comments

@deadmoto
Copy link
Contributor

The problem is in lifecycle bindings themselves.
Proguard is bind to process classes phase but Emma is bind to prepare package phase.
When both Emma and Proguard are enabled, plugin builds project in the following order:

  1. Compile classes and put into target/classes
  2. Run Proguard and put obfuscated/optimized classes into something_obfuscated.jar (depends on plugin version).
  3. Instrument classes in target/classes with Emma instrumentation
  4. Pack something_obfuscated.jar into DEX file

This way instrumented classes just won't get into DEX and you will get 37 bytes coverage.ec file which basically means it is empty.

To fix the problem it is possible to re-bind emma goal to process classes phase:

<executions>
    <execution>
        <id>default-emma</id>
        <phase>process-classes</phase>
    </execution>
</executions>

Problem exists in android-maven-plugin for a long time and I observed it in 3.6.0 and 3.9.0-rc.2.

@mosabua
Copy link
Member

mosabua commented Oct 23, 2014

If you got a fix... we would take it.

@mosabua
Copy link
Member

mosabua commented Nov 21, 2014

Can you submit a pull request?

@deadmoto
Copy link
Contributor Author

I am sorry for so long delay, I had a fix but I had no enough time to test it in real world.
I was unable to attach pull request to this issue directly so I have sent is as a regular pull request.
However I mentioned this issue in commit message so it must be referenced once approved.

@mosabua
Copy link
Member

mosabua commented Jan 8, 2015

Where did this go?

@mosabua
Copy link
Member

mosabua commented May 3, 2019

Closing old issue as cleanup

@mosabua mosabua closed this as completed May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants