【问题标题】:gradle - proguard errors do not reflect -dontwarngradle - proguard 错误不反映 -dontwarn
【发布时间】:2014-06-03 21:59:15
【问题描述】:

CLI 上 linux 上的 gradle 1.10

./gradlew clean

./gradlew assembleRelease

标准输出错误...

    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...class not found”错误:

        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

来自下面'./gradlew assembleRelease'的标准输出细节:

    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

'org.joda.**' 的 -dontwarn proguard 配置似乎不起作用..

我在配置中有“-dontnote **ILicensingService”,但这似乎不起作用。

com.google.android.gms.** 的 -dontwarn 配置不起作用

java.util.** 的 -dontwarn 不起作用

【问题讨论】:

    标签: android gradle proguard


    【解决方案1】:

    带有-dontwarn 标志的“sn-p”在哪个文件中?看起来你从来没有告诉过你的 build.gradle 文件关于这个 proguard 的配置。

    你有:

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

    但你也应该有:

    proguardFile 'your_proguard_config.cfg'
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-24
      • 2014-02-03
      • 2018-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多