2015-04-27 6 views
7

z Android Studio: 1.2.RCAndroid-Studio-1.2.RC PROGUARD ostrzeżenia na Okio Reference Library Square jest

Włączyłem ProGuard w .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' 

`` `

Ale wciąż te ostrzeżenia, gdy próbuję uruchomić aplikację w trybie debugowania:

``` 
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 

` ``

To takie dziwne, ponieważ dodałem również te zasady/opcje do wszystkich moich modułów bibliotecznych, które zależą od OkHttp/Picasso, nie wiem, gdzie poszło nie tak, być może jest to błąd Android Studio? Czy ktoś ma jakieś wskazówki dotyczące tego problemu?

Otworzyłem issue na github.

+0

Możesz zignorować te ostrzeżenia. https://github.com/square/okio/issues/60 –

Odpowiedz

2

O Chryste, zapomniałem określić plik PROGUARD dla mojego debugowania, dodając regułę „proguardFiles” rozwiązałoby problem:

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" 
     } 
    } 

Jedna z tych chwil, w których intensywnie przeszukujesz klucze i znajduje się ona w kieszeni.

+0

samo stało się ze mną. moją domyślną nazwą pliku proguard był "proguard-android.txt" i pisałem reguły w "proguard-rules.pro". –

19

Masz wyłączyć ostrzeżenia dla

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

ale co do pakietów (jak pisał w swoim dzienniku)

-dontwarn org.codehaus 
-dontwarn java.nio 

czy inaczej, ignorując ostrzeżenia nie jest dobrym podejściem.

Spróbuj utrzymanie tych klas przed minified tak:

-keep public class org.codehaus.** 
-keep public class java.nio.**