ProGuard: Problems using obfuscated JAR

巧了我就是萌 提交于 2019-12-11 11:37:50

问题


I have a JAR myapp-logic with classes, some of which are obfuscated and some non-obfuscated.

I want to use myapp-logic in a web application called myapp-web. When I add the obfuscated version of myapp-logic to the dependencies of myapp-web, I get following error message (when I run mvn clean compile):

EntryPageController.java:[55,41] incompatible types
found   : java.lang.Object
required: ru.altruix.ccp.logic.api.simfacade.SimulationFacade

The code with the error looks like this:

final SimulationFacadeFactory factory = this.injector.getInstance(SimulationFacadeFactory.class);
simulationFacade = factory.create(); // The error occurs here (line 55)

When I open the obfuscated myapp-logic JAR with Jad, SimulationFacadeFactory interface is not obfuscated (or looks like it was not obfuscated):

Original code:

package ru.altruix.ccp.logic.api.simfacade;

import ru.altruix.commons.api.conventions.Factory;

public interface SimulationFacadeFactory extends Factory<SimulationFacade> {
}

Eclipse doesn't show that error (it appears only in Maven).

What can I do in order to fix the error (make the code of myapp-web compile with reference to obfuscated myapp-logic) ?


回答1:


Try if that helps: In your Proguard Rules, especially the keep Signature might help.

<keepattribute name="*Annotation*" />
<keepattribute name="Signature" />
<keepattribute name="Exceptions" />


来源:https://stackoverflow.com/questions/13518872/proguard-problems-using-obfuscated-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!