天天看点

PullToRefreshWebView:can't find referenced method 'float floor(float)' in library class android.util具体错误出现原因

转载或引用请注明出处,谢谢!http://blog.csdn.net/wj9966

使用张鸿洋大神的 PullToRefresh,很好用,但是打包的时候报错PullToRefreshWebView:can't find referenced method 'float floor(float)' in library class android.util

使用PullToRefresh库方法:

在build.gradle中添加

compile 'com.github.userswlwork:pull-to-refresh:1.0.0'
           

具体错误

Warning:com.handmark.pulltorefresh.library.PullToRefreshWebView: can't find referenced method 'float floor(float)' in library class android.util.FloatMath

Warning:com.handmark.pulltorefresh.library.PullToRefreshWebView$InternalWebViewSDK9: can't find referenced method 'float floor(float)' in library class android.util.FloatMath

Warning:there were 2 unresolved references to library class members.

Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

> java.io.IOException: Please correct the above warnings first.

出现原因

PullToRefreshWebView中使用FloatMath.floor()来转换数据

protected boolean isReadyForPullEnd() {
        float exactContentHeight = FloatMath.floor((float)((WebView)this.mRefreshableView).getContentHeight() * ((WebView)this.mRefreshableView).getScale());
        return (float)((WebView)this.mRefreshableView).getScrollY() >= exactContentHeight - (float)((WebView)this.mRefreshableView).getHeight();
    }
           

解决办法

在项目中混淆时添加:

-dontwarn com.handmark.**
-keep class org.openudid.** { *; }
           

                                                                                        转载或引用请注明出处,谢谢!http://blog.csdn.net/wj9966