Предупреждения Android-Studio-1.2.RC Proguard о справке по библиотеке Square Okio

С Android Studio: 1.2.RC

Я включил proguard в .gradle: ```

minifyEnabled=true

and added these rules to my proguard-rules.pro:

-dontwarn com.squareup.**
-dontwarn okio.**

and added these lint rules to my .gradle file:

warningsAsErrors false
abortOnError false
disable 'InvalidPackage'

```

Но я все еще получаю это предупреждение, когда пытаюсь запустить приложение в режиме отладки:

```
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: there were 14 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardDebug FAILED

```

Это так странно, так как я также добавил эти правила/параметры ко всем модулям моей библиотеки, которые зависят от OkHttp/Picasso, я не знаю, что пошло не так, возможно, это ошибка Android Studio? Кто-нибудь имеет какие-либо ключи к этой проблеме?

Я открыл проблему на github.


person Bodhi Hu    schedule 27.04.2015    source источник
comment
Вы можете игнорировать эти предупреждения. github.com/square/okio/issues/60   -  person Pdksock    schedule 27.04.2015


Ответы (2)


Вы отключили предупреждения для

-dontwarn com.squareup.**
-dontwarn okio.**

Но как насчет пакетов (как видно из вашего опубликованного журнала)

-dontwarn org.codehaus
-dontwarn java.nio

В любом случае игнорировать предупреждения — не лучший подход.

Попробуйте предотвратить минимизацию этих классов следующим образом:

-keep public class org.codehaus.**
-keep public class java.nio.**
person Martin Konecny    schedule 27.04.2015

О Боже, я забыл указать файл proguard для моей отладочной сборки, добавление правила «proguardFiles» решило бы проблему:

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable false
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationIdSuffix ".debug"
        }
    }

Один из тех моментов, когда вы усердно искали свои ключи, и они прямо в вашем кармане.

person Bodhi Hu    schedule 28.04.2015
comment
то же самое произошло со мной. мое имя файла proguard по умолчанию было «proguard-android.txt», и я писал правила в «proguard-rules.pro». - person akshay bhange; 14.11.2015