在我的cordova项目中,由于某种原因,我必须运行cordova prepare android
两次,然后才能添加所有插件。第一次没有错误。
我正在使用cordova-android@^8.1.0
。还有
这些是使用的配置文件。还有一些其他文件,但与该问题无关。
我尝试使用cordova build android
,这会导致相同的问题。
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget defaultlocale="en-US" id="dualinventive.mtinfo3000" ios-CFBundleIdentifier="com.dualinventive.mtinfo3000" version="1.4.5" windows-packageVersion="1.4.4.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
<name>MTinfo 3000</name>
<description>MTinfo 3000</description>
<author email="maarten.manders@dualinventive.com" href="http://dualinventive.com">Dual Inventive</author>
<content src="index.html" />
<access origin="http://*.mtinfo3000.com" subdomains="true" />
<access origin="https://*.mtinfo3000.com" subdomains="true" />
<access origin="https://*.google.com/*" subdomains="true" />
<access origin="https://sentry.io" />
<vs:features />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="windows-target-version" value="10.0" />
<allow-navigation href="http://localhost:8080/*" />
<allow-navigation href="https://*.mtinfo3000.com" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
<hook src="scripts/android/010_copy_build_extras.js" type="after_platform_add" />
<allow-navigation href="*" />
<allow-intent href="market:*" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
</platform>
<platform name="ios">
<allow-navigation href="*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<platform name="android">
<icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
<icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
<icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
<icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
</platform>
<platform name="ios">
<icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
<icon height="60" src="res/icons/ios/icon-60.png" width="60" />
<icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
<icon height="76" src="res/icons/ios/icon-76.png" width="76" />
<icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
<icon height="40" src="res/icons/ios/icon-40.png" width="40" />
<icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
<icon height="57" src="res/icons/ios/icon-57.png" width="57" />
<icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" />
<icon height="72" src="res/icons/ios/icon-72.png" width="72" />
<icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
<icon height="29" src="res/icons/ios/icon-small.png" width="29" />
<icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
<icon height="87" src="res/icons/ios/icon-small-3x.png" width="87" />
<icon height="50" src="res/icons/ios/icon-50.png" width="50" />
<icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
<icon height="1024" src="res/icons/ios/icon-1024.jpg" width="1024" />
<icon height="167" src="res/icons/ios/icon-83.5-2x.png" width="167" />
<icon height="167" src="res/icons/ios/icon-167.png" width="167" />
</platform>
<platform name="windows">
<icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" />
<icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" />
<icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" />
<icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" />
<icon height="44" src="res/icons/windows/Square44x44Logo.scale-100.png" width="44" />
<icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" />
<icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" />
<icon height="71" src="res/icons/windows/Square71x71Logo.scale-100.png" width="71" />
<icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" />
<icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" />
<icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" />
<icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" />
<icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" />
</platform>
<platform name="wp8">
<icon height="62" src="res/icons/wp8/ApplicationIcon.png" width="62" />
<icon height="173" src="res/icons/wp8/Background.png" width="173" />
</platform>
<platform name="android">
<splash density="hdpi" src="res/screens/android/screen-hdpi-landscape.png" />
<splash density="ldpi" src="res/screens/android/screen-ldpi-landscape.png" />
<splash density="mdpi" src="res/screens/android/screen-mdpi-landscape.png" />
<splash density="xhdpi" src="res/screens/android/screen-xhdpi-landscape.png" />
<splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png" />
<splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png" />
<splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png" />
<splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" />
</platform>
<platform name="ios">
<splash src="res/screens/ios/Default@2x~universal~anyany.png" />
</platform>
<platform name="windows">
<splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" />
<splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" />
<splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" />
</platform>
<platform name="wp8">
<splash height="800" src="res/screens/wp8/SplashScreenImage.jpg" width="480" />
</platform>
<preference name="KeepRunning" value="True" />
<preference name="ShowTitle" value="True" />
<preference name="InAppBrowserStorageEnabled" value="True" />
<preference name="SuppressesIncrementalRendering" value="True" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#009EE0" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="Fullscreen" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="interceptbackbutton" value="false" />
<preference name="WindowsStoreDisplayName" value="MTinfo 3000" />
<preference name="WindowsStoreIdentityName" value="DualInventive.MTinfo3000" />
<preference name="WindowsStorePublisherName" value="Dual Inventive" />
<preference name="deployment-target" value="9.0" />
<preference name="ScrollEnabled" value="true" />
<plugin name="cordova-plugin-compat" spec="^1.2.0" />
<plugin name="cordova-plugin-device" spec="~1.1.0" />
<plugin name="cordova-plugin-dialogs" spec="^2.0.1" />
<plugin name="cordova-plugin-file-transfer" spec="git+https://github.com/dualinventive/cordova-plugin-file-transfer.git" />
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To share with other MTinfo users" />
</plugin>
<plugin name="cordova-plugin-globalization" spec="^1.0.7" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" />
<plugin name="cordova-plugin-sslcertificatechecker" spec="~5.0.0" />
<plugin name="cordova-plugin-statusbar" spec="~2.0.0" />
<plugin name="cordova-plugin-whitelist" spec="1.3.2" />
<plugin name="cordova-plugin-nativestorage" spec="2.2.2" />
<plugin name="cordova-plugin-network-information" spec="1.3.3" />
<plugin name="cordova-plugin-cookie-manager" spec="https://github.com/teunsteenbekkers/cordova-plugin-cookie-manager.git" />
<plugin name="cordova-plugin-add-swift-support" spec="^1.7.2" />
<plugin name="cordova-plugin-localization-strings" spec="git+https://github.com/cozy/cordova-plugin-localization-strings.git" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-background-download" spec="git+https://github.com/dualinventive/cordova-plugin-background-download.git#0.3.0" />
<plugin name="phonegap-plugin-push" spec="2.2.3">
<variable name="ANDROID_SUPPORT_V13_VERSION" value="27.+" />
<variable name="FCM_VERSION" value="11.6.2" />
</plugin>
<plugin name="cordova-plugin-windows-webview" spec="^0.5.4" />
<plugin name="cordova-plugin-file" spec="^5.0.0" />
<plugin name="phonegap-plugin-barcodescanner" spec="git+https://github.com/dualinventive/phonegap-plugin-barcodescanner.git">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>
<plugin name="sentry-cordova" spec="^0.16.2" />
<plugin name="cordova-open-native-settings" spec="git+https://github.com/dualinventive/Cordova-open-native-settings.git#v1.5.2" />
<plugin name="cordova-support-google-services" spec="~1.1.0" />
<plugin name="phonegap-plugin-multidex" spec="~1.0.0" />
<plugin name="cordova-plugin-camera" spec="^4.1.0">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
<variable name="CAMERA_USAGE_DESCRIPTION " value="To take pictures of equipment and upload them to MTinfo" />
<variable name="PHOTOlibraRY_USAGE_DESCRIPTION " value="To select pictures from your library and upload them to MTinfo" />
</plugin>
<plugin name="cordova-open-native-settings" spec="git+https://github.com/dualinventive/Cordova-open-native-settings.git#v1.5.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.1.2" />
<plugin name="cordova-support-google-services" spec="~1.1.0" />
<plugin name="phonegap-plugin-multidex" spec="~1.0.0" />
<plugin name="cordova-plugin-file-opener2" spec="^2.2.1">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>
<engine name="windows" spec="^6.0.1" />
<engine name="android" spec="^8.1.0" />
<engine name="ios" spec="^4.5.5" />
</widget>
package.json
{
"name": "mti","version": "1.0.0","dependencies": {
"cordova-android": "^8.1.0","cordova-ios": "^4.5.5","cordova-open-native-settings": "git+https://github.com/dualinventive/Cordova-open-native-settings.git#v1.5.2","cordova-plugin-add-swift-support": "^1.7.2","cordova-plugin-background-download": "git+https://github.com/dualinventive/cordova-plugin-background-download.git#0.3.0","cordova-plugin-camera": "^4.1.0","cordova-plugin-compat": "^1.2.0","cordova-plugin-cookie-manager": "https://github.com/teunsteenbekkers/cordova-plugin-cookie-manager.git","cordova-plugin-device": "~1.1.0","cordova-plugin-dialogs": "^2.0.1","cordova-plugin-file": "^5.0.0","cordova-plugin-file-opener2": "^2.2.1","cordova-plugin-file-transfer": "git+https://github.com/dualinventive/cordova-plugin-file-transfer.git","cordova-plugin-geolocation": "^2.4.3","cordova-plugin-globalization": "^1.0.7","cordova-plugin-inappbrowser": "~1.5.0","cordova-plugin-ionic-keyboard": "2.2.0","cordova-plugin-ionic-webview": "^4.1.2","cordova-plugin-localization-strings": "git+https://github.com/cozy/cordova-plugin-localization-strings.git","cordova-plugin-nativestorage": "2.2.2","cordova-plugin-network-information": "1.3.3","cordova-plugin-splashscreen": "^5.0.2","cordova-plugin-sslcertificatechecker": "~5.0.0","cordova-plugin-statusbar": "~2.0.0","cordova-plugin-whitelist": "1.3.2","cordova-plugin-windows-webview": "^0.5.4","cordova-support-google-services": "~1.1.0","cordova-windows": "^6.0.1","phonegap-plugin-barcodescanner": "git+https://github.com/dualinventive/phonegap-plugin-barcodescanner.git","phonegap-plugin-multidex": "~1.0.0","phonegap-plugin-push": "2.2.3","sentry-cordova": "^0.16.2"
},"cordova": {
"platforms": [
"windows","android","ios"
],"plugins": {
"cordova-open-native-settings": {},"cordova-plugin-compat": {},"cordova-plugin-device": {},"cordova-plugin-dialogs": {},"cordova-plugin-file-transfer": {},"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To share with other MTinfo users"
},"cordova-plugin-globalization": {},"cordova-plugin-inappbrowser": {},"cordova-plugin-sslcertificatechecker": {},"cordova-plugin-statusbar": {},"cordova-plugin-whitelist": {},"cordova-plugin-nativestorage": {},"cordova-plugin-network-information": {},"cordova-plugin-cookie-manager": {},"cordova-plugin-add-swift-support": {},"cordova-plugin-localization-strings": {},"cordova-plugin-splashscreen": {},"cordova-plugin-background-download": {},"phonegap-plugin-push": {
"ANDROID_SUPPORT_V13_VERSION": "27.+","FCM_VERSION": "11.6.2"
},"cordova-plugin-windows-webview": {},"cordova-plugin-file": {},"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},"sentry-cordova": {},"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+","CAMERA_USAGE_DESCRIPTION ": "To take pictures of equipment and upload them to MTinfo","PHOTOlibraRY_USAGE_DESCRIPTION ": "To select pictures from your library and upload them to MTinfo"
},"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},"cordova-plugin-ionic-keyboard": {},"cordova-plugin-ionic-webview": {},"cordova-support-google-services": {},"phonegap-plugin-multidex": {}
}
}
}
我希望以下内容存在:
- android.json
- cordova-open-native-settings /
- cordova-plugin-add-swift-support /
- cordova-plugin-background-download /
- cordova-plugin-camera /
- cordova-plugin-compat /
- cordova-plugin-cookie-manager /
- cordova-plugin-device /
- cordova-plugin-dialogs /
- cordova-plugin-file /
- cordova-plugin-file-opener2 /
- cordova-plugin-file-transfer /
- cordova-plugin-geolocation /
- cordova-plugin-globalization /
- cordova-plugin-inappbrowser /
- cordova-plugin-ionic-keyboard /
- cordova-plugin-ionic-webview /
- cordova-plugin-localization-strings /
- cordova-plugin-nativestorage /
- cordova-plugin-network-information /
- cordova-plugin-splashscreen /
- cordova-plugin-sslcertificatechecker /
- cordova-plugin-statusbar /
- cordova-plugin-whitelist /
- cordova-plugin-windows-webview /
- cordova-support-google-services /
- fetch.json
- phonegap-plugin-barcodescanner /
- phonegap-plugin-multidex /
- phonegap-plugin-push /
- sentry-cordova /
但是只有以下几点:
- android.json
- cordova-open-native-settings /
- cordova-plugin-add-swift-support /
- cordova-plugin-camera /
- cordova-plugin-compat /
- cordova-plugin-cookie-manager /
- cordova-plugin-device /
- cordova-plugin-dialogs /
- cordova-plugin-file /
- cordova-plugin-geolocation /
- cordova-plugin-globalization /
- cordova-plugin-inappbrowser /
- cordova-plugin-ionic-keyboard /
- cordova-plugin-ionic-webview /
- cordova-plugin-localization-strings /
- cordova-plugin-nativestorage /
- cordova-plugin-network-information /
- cordova-plugin-splashscreen /
- cordova-plugin-sslcertificatechecker /
- cordova-plugin-statusbar /
- cordova-plugin-whitelist /
- cordova-plugin-windows-webview /
- cordova-support-google-services /
- fetch.json
- phonegap-plugin-barcodescanner /
- phonegap-plugin-multidex /
- phonegap-plugin-push /
- sentry-cordova /