3

我们使用 Cordova 和 Ionic 3 开发了一个应用程序,在将我们的应用程序的新版本更新到 Play 商店后,我们收到了以下警告。

以下是警告的屏幕截图:

在此处输入图像描述

我们用作环境:

cordova-android: 7.1.4
cordova-cli: 8.0.0
ionic: 3.20.0

我发现的唯一相关代码在cordova引擎下的文件SystemWebViewClient.java中,我们无法真正更改并且从未更改过,因为它位于生成的文件夹platforms/android/CordovaLib/src/org/apache/cordova/engine/下.

这是可以找到的代码:

 /**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}

有没有人找到解决这个问题的方法?

4

0 回答 0