gradle - proguard错误不反映-dontwarn

时间:2014-06-03 21:59:16

标签: android gradle proguard

在CLI上的Linux上使用gradle 1.10

./ gradlew clean

./ gradlew assembleRelease

stdout中的错误......

    Note: there were 2 references to unknown classes.
          You should check your configuration for typos.
          (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
    Note: there were 5 unresolved dynamic references to classes or interfaces.
          You should check if you need to specify additional program jars.
          (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
    Warning: there were 106 unresolved references to classes or interfaces.
             You may need to add missing library jars or update their versions.
:proguardRelease FAILED
:proguardRelease (Thread[main,5,main]) completed. Took 4.689 secs.

FAILURE: Build failed with an exception.

我扩展了一个捆绑gradle的oss包用于发布版本(添加了jackson.json但不是来自maven central)。

出于某种原因,proguard投掷了数百个未找到的org.joda.time ...尽管存在以下错误,但仍然存在错误:

        release {
             runProguard true
             proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
         }   // in 'build.gradle'

-dontwarn android.support.**
-dontwarn org.joda.time.**
-dontwarn org.codehaus.jackson.**
-dontwarn ch.boye.httpclientandroidlib.**
-dontwarn org.apache.http.**
-dontwarn android.**
-dontwarn java.**
-dontwarn com.google.sample.castcompanionlibrary.**
-dontwarn org.w3c.dom.**
-dontwarn com.google.android.gms.maps.**

    #rcr adds
    -libraryjars  /usr/local/src/android-sdk-linux/platforms/android-19/android.jar
    -libraryjars <java.home>/lib/rt.jar
    -libraryjars libs/jackson-core-lgpl-1.9.2.jar
    -libraryjars libs/jackson-mapper-lgpl-1.9.2.jar
    -libraryjars libs/Parse-1.1.3.jar
    -libraryjars libs/httpclient-1.1.jar

stdout DETAIL来自&#39; ./ gradlew assembleRelease&#39;下面:

    Initializing...
    Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
    Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
    Note: the configuration refers to the unknown class 'Object'
          Maybe you meant the fully qualified name 'java.lang.Object'?
    Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
    Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
    Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
    Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.DateTime
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableDateTime
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableInstant
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime
    Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
    Warn

    ... 100s more in 'org.joda.time.**'

Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: com.google.android.gms.maps.internal.q: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImplGmm6
Note: com.google.android.gms.maps.internal.q: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImpl
Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentNavigableMap
Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentSkipListM

-dontwarn proguard配置&#39; org.joda。**&#39;似乎没有工作..

我有&#34; -dontnote ** ILicensingService&#34;在配置中,似乎不起作用。

com.google.android.gms的-dontwarn配置。**无法正常工作

java.util的-dontwarn。**无法正常工作

1 个答案:

答案 0 :(得分:5)

您的&#34;代码段是什么文件?#34;用-dontwarn标志?您似乎没有告诉您的build.gradle文件有关该proguard配置。

你有:

proguardFile getDefaultProguardFile('proguard-android-optimize.txt')

但你也应该:

proguardFile 'your_proguard_config.cfg'

这样它将同时使用默认的Android配置和配置。