java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse

情到浓时终转凉″ 提交于 2020-01-02 03:35:10

问题


I am facing this exception

"java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse" while implementing webview in android.

I have searched for an appropriate solution over the web but didn't find anything useful.

My XML file is this

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include layout="@layout/toolbar_title" />


        <im.delight.android.webview.AdvancedWebView
            android:id="@+id/mWebview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

</RelativeLayout>

And my java code against this XML is

public class PaymentActivity extends ParentActivity implements AdvancedWebView.Listener {

//    private WebView webView;

private AdvancedWebView mWebView;
ProgressDialog dialog;
UserModel userModel;
SessionManager sessionManager;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_payment);

    ButterKnife.bind(this);
    setActionBar("Payment");
    sessionManager = new SessionManager(this);
    userModel = sessionManager.getUserInformation();

    mWebView = findViewById(R.id.mWebview);
    mWebView.setListener(this, this);
    mWebView.getSettings().setJavaScriptEnabled(true);


    String planType = getIntent().getStringExtra("planType");

    String url = "www.google.com";

    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading");
    dialog.setCancelable(false);

    mWebView.loadUrl(url);


}


@Override
public void onPageStarted(String url, Bitmap favicon) {

    dialog.show();
}

@Override
public void onPageFinished(String url) {
    dialog.dismiss();
}

@Override
public void onDownloadRequested(String url, String suggestedFilename, String mimeType, long contentLength, String contentDisposition, String userAgent) {

}

@Override
public void onExternalPageRequest(String url) {

}

@Override
public void onPageError(int errorCode, String description, String failingUrl) {

}

My compileSdkVersion is 26, minSdkVersion is 17 and targetSdkVersion is 22. I am testing this code on Android 8.0 API 26.

Any help in this regard will be highly appreciated.


回答1:


According to the documentation, this class was added in Android level 27. You are trying to use it on level 26 test platform. Naturally, the platform cannot load the class ... that it doesn't know about.



来源:https://stackoverflow.com/questions/51381482/java-lang-noclassdeffounderror-failed-resolution-of-landroid-webkit-safebrowsi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!