Proguard的 - 如何创建具有共享输入罐子多出罐 [英] Proguard - How to create multiple output jars with shared input jars

查看:268
本文介绍了Proguard的 - 如何创建具有共享输入罐子多出罐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我想每个输出罐子包括injars它上面:

 #Windows客户端
-injars common.jar
-injars windowsClient.jar
-outjar windowsClient.jar#Mac客户
-injars common.jar
-injars macClient.jar
-outjar macClient.jar#在Windows Server
-injars common.jar
-injars windowsServer.jar
-outjar windowsServer.jar#苹果服务器
-injars common.jar
-injars macServer.jar
-outjar macServer.jar

所以此工程,并只包括针对每个罐子code。问题是,我也得到吨从ProGuard的警告节目类的定义复制。我想这是因为复制 -injars common.jar ,但我不知道如何解决这个问题。如果我从那么每个分组中删除 -injars common.jar 我得到一个错误大约有使用过滤器。

有例如说一个方法:

 #的Windows Server(3步)
-removeJars macClient.jar
-injars ...
-outjars windowsServer.jar


解决方案

的ProGuard的目的是(从打印出票据除外)忽略重复输入类和每个加工类写一个罐子。你可以为commons.jar创建一个单独的输出罐子并将其合并到另一个罐子以后。

您招恰好工作,由同一commons.jar多次低效有所阅读。您可以燮preSS的警告与 -dontnote

注:


  • 输入罐子和瓶子输出的名称必须是不同的。

  • 您可能需要禁用类合并( -optimizations!类/合并/ * ),以保持类从罐之间迁移。

So for example I want each output jar to include both injars just above it:

# Windows Client
-injars common.jar
-injars windowsClient.jar
-outjar windowsClient.jar

# Mac Client
-injars common.jar
-injars macClient.jar
-outjar macClient.jar

# Windows Server 
-injars common.jar
-injars windowsServer.jar
-outjar windowsServer.jar

# Mac Server 
-injars common.jar
-injars macServer.jar
-outjar macServer.jar

So this works and only includes the code specific for each jar. The problem is that I also get tons of "Duplication of definition of program class" warnings from proguard. I assume it's because of the duplicated -injars common.jar, but I don't know how to resolve that. If I remove -injars common.jar from each grouping then I get an error about having to use a filter.

Is there a way for example to say:

# Windows Server (3 step)
-removeJars macClient.jar
-injars ...
-outjars windowsServer.jar

解决方案

ProGuard's intention is to ignore duplicate input classes (apart from printing out notes) and to write each processed class to a single jar. You could create a separate output jar for commons.jar and merge it into the other jars later on.

Your trick happens to work, by somewhat inefficiently reading the same commons.jar multiple times. You can suppress the warnings with -dontnote.

Notes:

  • The names of input jars and output jars must be different.
  • You may want to disable class merging (-optimizations !class/merging/*), to keep classes from migrating between jars.

这篇关于Proguard的 - 如何创建具有共享输入罐子多出罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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