简体   繁体   English

Android Proguard - 一步一步

[英]Android Proguard - step by step

I'm trying for the first time to use ProGuard on my Android project. 我正在尝试第一次在我的Android项目上使用ProGuard。

I have a couple of questions: 我有一些问题:

  1. For jar-files in the /libs folder, how should they be referenced in the proguard-project.txt ? 对于/ libs文件夹中的jar文件,应该如何在proguard-project.txt引用它们?

    • -injars /libs/commons-lang3-3.1.jar
    • or 要么
    • -libraryjars /libs/commons-lang3-3.1.jar
    • ?
  2. Do I have to write something down in the proguard-project.txt for libraries that are library projects in my workspace? 我是否必须在proguard-project.txt为我的工作区中的库项目库编写一些内容?

  3. I get a lot or warnings like this: 我得到了很多或像这样的警告:

-> - >

[2013-08-12 14:27:13 - xy.de] Warning: library class android.graphics.drawable.LayerDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.graphics.drawable.ShapeDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.graphics.drawable.ShapeDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.graphics.drawable.StateListDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlSerializer
[2013-08-12 14:27:13 - xy.de] Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-12 14:27:13 - xy.de] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser

what's up with that? 那是怎么回事? XmlPullParser is a part of the Android framework right? XmlPullParser是Android框架的一部分吗? How can it be missing? 它怎么会丢失?

4.. 4 ..

[2013-08-12 14:27:13 - bauen.de] Warning: there were 42 unresolved references to program class members.
[2013-08-12 14:27:13 - bauen.de]          Your input classes appear to be inconsistent.
[2013-08-12 14:27:13 - bauen.de]          You may need to recompile them and try again.
[2013-08-12 14:27:13 - bauen.de]          Alternatively, you may have to specify the option 
[2013-08-12 14:27:13 - bauen.de]          '-dontskipnonpubliclibraryclassmembers'.

Should I really set -dontskipnonpubliclibraryclassmembers ? 我真的应该设置-dontskipnonpubliclibraryclassmembers吗?

  1. Is there a certain order that the settings in the proguard-project.txt must be set? 是否必须设置proguard-project.txt中的设置?

One of your libraries contains copies of org.xmlpull.v1 classes, even though those are already present in the Android runtime. 其中一个库包含org.xmlpull.v1类的副本,即使这些类已存在于Android运行时中。 You should remove those classes from the libraries. 您应该从库中删除这些类。 The versions in the Android runtime would get precedence anyway. Android运行时中的版本无论如何都会优先。

Cfr. (CFR)。 ProGuard manual > Troubleshooting > Warning: library class ... depends on program class ... ProGuard手册>故障排除> 警告:库类......取决于程序类......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM