如何从 proguard 构建中排除 R*.class 文件
我距离制定此处描述的方法仅一步之遥: 使用 Scala 2.8 Trunk 构建定位 Android
与单个项目配合使用(对比一个 scala 项目和一个 android 项目)。
我遇到了一个问题。使用此输入文件(参数)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,但它似乎包含了 android 资源构建器生成和编译的生成的 R 类。在本例中,它们位于 bin/org/jeb/R*.class 中。这不是我想要的。 android dalvik 转换器无法构建,因为它认为存在 R 类的重复项(它位于 scandroid 以及 R*.class 文件中)。如何修改上述 proguard 参数以从 scandroid.jar 中排除 R*.class 文件,以便 dalvik 转换器满意? 编辑:我应该注意,我尝试添加 ;bin/org/jeb/R.class;etc... 到 -libraryjars 参数中,这似乎只会导致它抱怨重复的类,此外 proguard 决定排除我的 scala 类文件也是如此。
I am one step away from making the method described here:
Targeting Android with Scala 2.8 Trunk builds
work with a single project (vs one project for scala and one for android).
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 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?
Edit: 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用这个选项。您可以从下面的链接找到参考并找到“完整的 Android 应用程序”。
http://proguard.sourceforge.net/index.html#/manual/examples.html
I use this option. You can find reference from link below and find "A complete Android application".
http://proguard.sourceforge.net/index.html#/manual/examples.html
文件过滤器 !**/*R.java 换句话说,这个留置权强制 Proguard 将除 R.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