6

I have a version of file android.webkit.WebViewClient in my application source directory in order to handle onReceivedSslError in my own extended version of WebViewClient. When I use the new ProGuard integration in sdk-7 I get the following warning:

[proguard] Warning: library class android.webkit.WebView depends on program class android.webkit.WebViewClient

...

 [proguard] Warning: there were 1 instances of library classes depending on program classes.
 [proguard]          You must avoid such dependencies, since the program classes will
 [proguard]          be processed, while the library classes will remain unchanged.

Can anyone tell me how to fix this in my proguard.cfg? Thanks :)

aminography
  • 21,986
  • 13
  • 70
  • 74
user1318700
  • 63
  • 1
  • 1
  • 5
  • You shouldn't need to put a library class in your source directory. Can't you just extend the framework class directly? – Matthew Flaschen Apr 07 '12 at 06:52
  • Unfortunately, I am working around the bug described here for OS's before Froyo http://damianflannery.wordpress.com/2010/09/28/android-webview-with-https-loadurl-shows-blankempty-page/ Because there are some private apis, I can't simply extend the class :( – user1318700 Apr 09 '12 at 09:20

3 Answers3

23

I encountered the same problem, and by hint of above, I write these lines into proguard.cfg and the problem gets solved:

-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient

-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
cox
  • 466
  • 4
  • 8
0

Try adding the following in your proguard.cfg or proguard-project.txt file:

-dontwarn android.webkit.WebView
mharper
  • 3,212
  • 1
  • 23
  • 23
0

This maybe a bit late, but I had the same issue. I needed to support SSL connections in WebView on androids lower than 2.2.

I was able to build apk with proguard successfully by following:

  • as said in comments - remove android.webkit.WebViewClient from your source, instead create your own class and extend original WebViewClient with only onRecieveSslError method inside (no overriding).

  • replace existing WebViewClient usage with a new one

  • SslError can be left unchanged, since on SDK 7 and lower it doesn't exists in open API, so proguard will not notice it.

That's it.

lia ant
  • 408
  • 5
  • 10