首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ionic6电容:在添加"cordova-plugin-advanced-http“之后,工作室中的应用程序构建开始出现错误,找不到符号CordovaPluginPathHandler。

Ionic6电容:在添加"cordova-plugin-advanced-http“之后,工作室中的应用程序构建开始出现错误,找不到符号CordovaPluginPathHandler。
EN

Stack Overflow用户
提问于 2022-04-15 11:24:48
回答 3查看 6.7K关注 0票数 6

请帮助解决这个问题。在命令“离子电容构建android”之后,我就可以在android工作室中构建应用程序了。在我添加插件cordova- plugin -advanced-http之前,Android运行良好,错误声明如下:

D:\temp\myApp4\android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\file\FileUtils.java:39:错误:找不到符号导入org.apache.cordova.CordovaPluginPathHandler;^符号:类CordovaPluginPathHandler位置: package org.apache.cordova

代码语言:javascript
复制
[capacitor] [info] Found 5 Cordova plugins for android:
[capacitor]        cordova-plugin-advanced-http@3.3.1
[capacitor]        cordova-plugin-file@7.0.0
[capacitor]        cordova-plugin-geolocation@4.1.0
[capacitor]        cordova-plugin-nativestorage@2.3.2
[capacitor]        cordova-plugin-request-location-accuracy@2.3.0
[capacitor] √ copy android in 4.44s
[capacitor] √ Updating Android plugins in 25.69ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor]        @capacitor/app@1.1.1
[capacitor]        @capacitor/haptics@1.1.4
[capacitor]        @capacitor/keyboard@1.2.2
[capacitor]        @capacitor/status-bar@1.0.8
[capacitor] [info] Found 5 Cordova plugins for android:
[capacitor]        cordova-plugin-advanced-http@3.3.1
[capacitor]        cordova-plugin-file@7.0.0
[capacitor]        cordova-plugin-geolocation@4.1.0
[capacitor]        cordova-plugin-nativestorage@2.3.2
[capacitor]        cordova-plugin-request-location-accuracy@2.3.0```
EN

回答 3

Stack Overflow用户

发布于 2022-05-19 07:44:34

你应该升级cordova android的版本。

对于文件android/variables.gradle

cordovaAndroidVersion = '7.0.0'更改为cordovaAndroidVersion = '10.1.2'

同时,您应该将minSdkVersion更改为>= 22。

票数 22
EN

Stack Overflow用户

发布于 2022-05-06 18:25:16

作为一种临时解决方案,我将cordova-plugin-file的版本降为6.0.2,它适用于我。

票数 9
EN

Stack Overflow用户

发布于 2022-04-23 20:55:18

为确保这一工作,做好以下工作;

  1. 转到您的文件资源管理器( <android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\file> <android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\file><android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\file>)上的这个位置以使应用程序正常工作。
  2. 创建一个新的文件名为
  3. 文件,然后粘贴下面的代码

代码语言:javascript
复制
    /*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
*/

package org.apache.cordova;

import androidx.webkit.WebViewAssetLoader;

/**
 * Wrapper class for path and handler
 */
public class CordovaPluginPathHandler {

    private final WebViewAssetLoader.PathHandler handler;

    public  CordovaPluginPathHandler(WebViewAssetLoader.PathHandler handler) {
        this.handler = handler;
    }

    public WebViewAssetLoader.PathHandler getPathHandler() {
        return handler;
    }
}

  1. 保存文件,然后去构建应用程序.
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71883439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档