如何从Proguard构建中排除R * .class文件 [英] How to exclude R*.class files from a proguard build

查看:172
本文介绍了如何从Proguard构建中排除R * .class文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我离开这里描述的方法一步之遥:
使用Scala定位Android 2.8中继线构建

I am one step away from making the method described here: Targeting Android with Scala 2.8 Trunk builds

使用单个项目(vs一个项目为scala,一个为android)。

work with a single project (vs one project for scala and one for android).

我遇到了一个问题。使用这个输入文件(参数)proguard:

I've come across a problem. Using this input file (arguments to) proguard:

-injars bin;lib/scala-library.jar(!META-INF/MANIFEST.MF,!library.properties)

-outjar lib/scandroid.jar

-libraryjars lib/android.jar

-dontwarn
-dontoptimize
-dontobfuscate
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
                SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep public class org.scala.jeb.** { public protected *; }
-keep public class org.xml.sax.EntityResolver { public protected *; }

Proguard成功构建scandroid.jar,但是它似乎已经包含生成的R类,android资源构建器生成并编译。在这种情况下,它们位于bin / org / jeb / R * .class中。这不是我想要的。 android dalvik转换器无法构建,因为它认为有一个重复的R类(它在scandroid,也是R * .class文件)。如何修改上述proguard参数以从scandroid.jar中排除R * .class文件,以便dalvik转换器很开心?
编辑:我应该注意到,我尝试添加; bin / org / jeb / R.class;等...到-libraryjars参数,这只是似乎导致它抱怨重复的类,另外proguard决定排除我的scala类文件。

Proguard successfully builds scandroid.jar, however it appears to have included the generated R classes that the android resource builder generates and compiles. In this case, they are located in bin/org/jeb/R*.class. This is not what I want. The android dalvik converter cannot build because it thinks there is a duplicate of the R class (it's in scandroid and also the R*.class files). How can I modify the above proguard arguments to exclude the R*.class files from the scandroid.jar so the dalvik converter is happy? I should note that I tried adding ;bin/org/jeb/R.class;etc... to the -libraryjars argument, and that only seemed to cause it to complain about duplicate classes, and in addition proguard decided to exclude my scala class files too.

推荐答案

文件过滤器** / * R.java换句话说这个留置权强制Proguard将除了.java文件之外的所有Java文件保存在模糊化

file filter !**/*R.java in other words this lien forces Proguard to keep all java files except R.java files in the obfuscation

这篇关于如何从Proguard构建中排除R * .class文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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