简体   繁体   中英

Android Proguard - step by step

I'm trying for the first time to use ProGuard on my Android project.

I have a couple of questions:

  1. For jar-files in the /libs folder, how should they be referenced in the 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?

  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? How can it be missing?

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 ?

  1. Is there a certain order that the settings in the proguard-project.txt must be set?

One of your libraries contains copies of org.xmlpull.v1 classes, even though those are already present in the Android runtime. You should remove those classes from the libraries. The versions in the Android runtime would get precedence anyway.

Cfr. ProGuard manual > Troubleshooting > Warning: library class ... depends on program class ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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