ProGuard:使用混淆的JAR时出现问题 [英] ProGuard: Problems using obfuscated JAR

查看:521
本文介绍了ProGuard:使用混淆的JAR时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有类的JAR myapp-logic,其中有些是混淆的,有些是非混淆的.

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

我想在名为myapp-web的Web应用程序中使用myapp-logic.当我将混淆后的版本myapp-logic添加到myapp-web的依赖项时,出现以下错误消息(当我运行mvn clean compile时):

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

出现错误的代码如下:

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

当我使用Jad打开混淆的myapp-logic JAR时,SimulationFacadeFactory界面没有被混淆(或看起来好像没有被混淆):

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

原始代码:

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

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

public interface SimulationFacadeFactory extends Factory<SimulationFacade> {
}

Eclipse不会显示该错误(仅在Maven中显示).

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

我该怎么做才能纠正错误(使myapp-web的代码参考模糊化的myapp-logic进行编译)?

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

推荐答案

尝试一下是否有帮助: 在您的Proguard规则中,尤其是keep Signature可能会有所帮助.

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

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

这篇关于ProGuard:使用混淆的JAR时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆