首页 > 解决方案 > 没有可用的插件 cordova-android 10

问题描述

最近我们迁移到了 cordova-android@10.1.1(从 6.4.0 版本开始——向前迈出了一大步)。

问题

在成功构建 Android 应用程序并在新的 Android Studio(版本 2020.3.1.patch 3)中安装“android”文件夹并运行应用程序后,我们发现所有插件都消失了(所以在控制台我们可以看到所有关于插件使用)。

为了能够导入插件,是否需要在构建时或之后进行设置?

下面是生成的项目结构

在我们的config.xml配置下方:

 <?xml version='1.0' encoding='utf-8'?>
<widget android-activityName="xxx" id="com.yyy.xxx"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:gap="http://phonegap.com/ns/1.0">
    <name>APP_TOBUILD_NAME</name>
    <description>description</description>
    <author email="sviluppo@yyy.com" href="https://www.yyy.com/">       Contact us  </author>
    <content src="index.html" />

    <engine name="android" spec="10.1.1"/>
    <!-- <engine name="android" spec="https://github.com/apache/cordova-android.git#10.1.1" /> -->
    <engine name="ios" spec="6.2.0" />



    <!-- <preference name="GradlePluginGoogleServicesEnabled" value="true" /> -->
    <!-- <preference name="GradlePluginGoogleServicesVersion" value="4.3.8" /> -->

    <!-- Permissions -->

    <access origin="*"/>
    <allow-intent href="sms:*" />
    <allow-intent href="tel:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="file://*/*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-navigation href="http://*/*" />
    <allow-navigation href="https://*/*" />


    <!-- SCHEME and DOMAIN  -->
    <preference name="scheme" value="ionic" />
    <preference name="hostname" value="localhost" />
    <preference name="Scheme" value="ionic" />
    <preference name="iosScheme" value="ionic" />
    <preference name="Hostname" value="localhost" />
    <preference name="WKPort" value="" />


    <!-- Preferences -->

    <preference name="webviewbounce" value="false" />
    <preference name="KeyboardResize" value="false" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="StatusBarStyle" value="lightcontent" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false"/>

    <!-- Splash screen -->
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="FadeSplashScreenDuration" value="400" />
    <preference name="SplashScreenDelay" value="3000" />

    <!-- Hooks -->

    <hook src="www/hooks/fwk-after-prepare-hooks.js" type="after_prepare" />
    <hook src="www/hooks/fwk-after-plugin-add-hooks.js" type="after_plugin_add" />
    <hook src="www/hooks/fwk-after-prepare-copy-build-extra-hooks.js" type="after_prepare" />
    <hook src="www/hooks/fwk-after-compile-hooks.js" type="after_compile" />
    <hook src="www/hooks/fwk-before-build-hooks.js" type="before_build" />

    <!-- Android -->

    <platform name="android">

        <preference name="AndroidXEnabled" value="true" />

        <!-- SDK version -->
        <preference name="android-maxSdkVersion" value="30" />
        <preference name="android-targetSdkVersion" value="30" />
        <preference name="android-minSdkVersion" value="22" />

        <!-- Resources -->
        <icon density="ldpi" src="www/res/icon/android/icon-ldpi.png" />
        <icon density="mdpi" src="www/res/icon/android/icon-mdpi.png" />
        <icon density="hdpi" src="www/res/icon/android/icon-hdpi.png" />
        <icon density="xhdpi" src="www/res/icon/android/icon-xhdpi.png" />
        <icon density="xxhdpi" src="www/res/icon/android/icon-xxhdpi.png" />
        <icon density="xxxhdpi" src="www/res/icon/android/icon-xxxhdpi.png" />
        <icon src="www/res/icon/android/icon-market.png" />
        <icon src="www/res/icon/android/icon.png" />

        <resource-file src="www/google-services.json" target="/app/src/debug/google-services.json" />

        <resource-file src="www/res/icon/android/icon-ldpi.png" target="res/drawable-ldpi/icon.png" />
        <resource-file src="www/res/icon/android/icon-mdpi.png" target="res/drawable-mdpi/icon.png" />
        <resource-file src="www/res/icon/android/icon-hdpi.png" target="res/drawable-hdpi/icon.png" />
        <resource-file src="www/res/icon/android/icon-xhdpi.png" target="res/drawable-xhdpi/icon.png" />
        <splash density="ldpi" src="www/res/splashscreen/android/ldpi.png" />
        <splash density="mdpi" src="www/res/splashscreen/android/mdpi.png" />
        <splash density="hdpi" src="www/res/splashscreen/android/hdpi.png" />
        <splash density="xhdpi" src="www/res/splashscreen/android/xhdpi.png" />
        <splash density="xxhdpi" src="www/res/splashscreen/android/xxhdpi.png" />
        <splash density="xxxhdpi" src="www/res/splashscreen/android/xxxhdpi.png" />

    </platform>

    <!-- iOS -->

    <platform name="ios">

        <!-- CORS -->

        <!-- From cordova-ios 6.x doc. -->
        <preference name="scheme" value="ionic" />
        <preference name="hostname" value="localhost" />

        <!-- From cordova-plugin-ionic-migrate-storage github -->
        <preference name="Scheme" value="ionic" />
        <preference name="iosScheme" value="ionic" />
        <preference name="Hostname" value="localhost" />
        <preference name="WKPort" value="" />

        <!-- Storage Porting -->
        <!-- From 'file__0.localstorage' format to 'app_localhost_0.localstorage' -->
        <preference name="MIGRATE_STORAGE_ORIGINAL_SCHEME" value="file" />
        <preference name="MIGRATE_STORAGE_ORIGINAL_HOSTNAME" value="" />
        <preference name="MIGRATE_STORAGE_ORIGINAL_PORT_NUMBER" value="0" />

        <!-- Resouces -->
        <resource-file src="www/GoogleService-Info.plist" />
        <icon height="20" src="www/res/icon/ios/Icon-20.png" width="20" />
        <icon height="48" src="www/res/icon/ios/AppIcon24x24@2x.png" width="48" />
        <icon height="55" src="www/res/icon/ios/AppIcon27.5x27.5@2x.png" width="55" />
        <icon height="88" src="www/res/icon/ios/AppIcon44x44@2x.png" width="88" />
        <icon height="172" src="www/res/icon/ios/AppIcon86x86@2x.png" width="172" />
        <icon height="196" src="www/res/icon/ios/AppIcon98x98@2x.png" width="196" />
        <icon height="29" src="www/res/icon/ios/Icon-Small.png" width="29" />
        <icon height="40" src="www/res/icon/ios/Icon-Small-40.png" width="40" />
        <icon height="40" src="www/res/icon/ios/AppIcon24x24@2x.png" width="40" />
        <icon height="40" src="www/res/icon/ios/Icon-20@2x.png" width="40" />
        <icon height="50" src="www/res/icon/ios/Icon-50.png" width="50" />
        <icon height="57" src="www/res/icon/ios/Icon.png" width="57" />
        <icon height="58" src="www/res/icon/ios/AppIcon29x29@2x.png" width="58" />
        <icon height="60" src="www/res/icon/ios/Icon-20@3x.png" width="60" />
        <icon height="58" src="www/res/icon/ios/Icon-Small@2x.png" width="58" />
        <icon height="72" src="www/res/icon/ios/Icon-72.png" width="72" />
        <icon height="76" src="www/res/icon/ios/Icon-76.png" width="76" />
        <icon height="80" src="www/res/icon/ios/Icon-Small-40@2x.png" width="80" />
        <icon height="80" src="www/res/icon/ios/AppIcon40x40@2x.png" width="80" />
        <icon height="80" src="www/res/icon/ios/Icon-Small-40@2x.png" width="80" />
        <icon height="87" src="www/res/icon/ios/Icon-Small@3x.png" width="87" />
        <icon height="87" src="www/res/icon/ios/AppIcon29x29@3x.png" width="87" />
        <icon height="100" src="www/res/icon/ios/Icon-50@2x.png" width="100" />
        <icon height="114" src="www/res/icon/ios/Icon@2x.png" width="114" />
        <icon height="120" src="www/res/icon/ios/Icon-60@2x.png" width="120" />
        <icon height="120" src="www/res/icon/ios/Icon-Small-40@3x.png" width="120" />
        <icon height="144" src="www/res/icon/ios/Icon-72@2x.png" width="144" />
        <icon height="152" src="www/res/icon/ios/Icon-76@2x.png" width="152" />
        <icon height="167" src="www/res/icon/ios/Icon-83.5@2x.png" width="167" />
        <icon height="180" src="www/res/icon/ios/Icon-60@3x.png" width="180" />
        <icon height="1024" src="www/res/icon/ios/icon-1024.png" width="1024" />

        <splash src="www/res/splashscreen/ios/Default@2x~universal~anyany.png"/>

    </platform>


    <!-- PLUGINS LIST -->

    <!-- NOTES -->
    <!-- Plugin 'cordova-plugin-firebase' forked due to the error on iOS -->
    <!-- Failed to install 'cordova-plugin-firebase': CordovaError: Using 
    "requireCordovaModule" to load non-cordova module "xcode" is not 
    supported. Instead, add this module to your dependencies and use 
    regular "require" to load it. -->

    <!-- LIST -->
    <!-- PLUGIN_DEFINITIONS -->
</widget>

标签: androidcordovaionic-frameworkcordova-android

解决方案


推荐阅读