Ionic 无法解析离子电容器应用程序上的符号“白名单”

zu0ti5jz  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(200)

我正在接受这个错误。我不知道我为什么要接受。我不能在android上构建。
使用:
Angular CLI:8.1.3
节点:16.17.1
电容器:6.20.3

sigwle7e

sigwle7e1#

Replace Whitelist class with AllowList in cordova-plugin-file-transfer > src > android > FileTransfer.java
import org.apache.cordova.Whitelist; => import org.apache.cordova.AllowList;

/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
     * Previously the CordovaWebView class had a method, getWhitelist, which would
     * return a Whitelist object. Since the fixed whitelist is removed in Cordova 4.x,
     * the correct call now is to shouldAllowRequest from the plugin manager.
     */
    Boolean shouldAllowRequest = null;
    if (isLocalTransfer) {
        shouldAllowRequest = true;
    }
    if (shouldAllowRequest == null) {
        try {
            Method gwl = webView.getClass().getMethod("getWhitelist");
            AllowList whitelist = (AllowList)gwl.invoke(webView);
            shouldAllowRequest = whitelist.isUrlAllowListed(source);
        } catch (NoSuchMethodException e) {
        } catch (IllegalAccessException e) {
        } catch (InvocationTargetException e) {
        }
    }

Replace the above code with :

/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
   * Previously the CordovaWebView class had a method, getWhitelist, which would
   * return a Whitelist object. Since the fixed whitelist is removed in Cordova 4.x,
   * the correct call now is to shouldAllowRequest from the plugin manager.
   */
  Boolean shouldAllowRequest = null;
  if (isLocalTransfer) {
      shouldAllowRequest = true;
  }
  if (shouldAllowRequest == null) {
      try {
          Method gwl = webView.getClass().getMethod("getWhitelist");
          AllowList whitelist = (AllowList)gwl.invoke(webView);
          shouldAllowRequest = whitelist.isUrlAllowListed(source);
      } catch (NoSuchMethodException e) {
      } catch (IllegalAccessException e) {
      } catch (InvocationTargetException e) {
      }
  }

Source : See this Github Gist

相关问题