构建Android APK时config.xml中没有列出cordova平台

时间:2019-04-30 09:08:24

标签: ionic-framework ionic3 cordova-plugins

我正在使用此命令在设备上部署android应用。

$ ionic cordova构建android

但是我没有警告任何特定的错误。

config.xml中未列出任何Cordova平台。没什么准备

我的离子信息:

  @ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

全局软件包:

Cordova CLI : 8.0.0

本地软件包:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

系统:

Android SDK Tools : 26.1.1
Node              : v8.11.0
npm               : 5.6.0
OS                : Windows 7

还有我的config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="****" id="****" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="data:*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="none" />
<preference name="KeepRunning" value="false" />
<preference name="LoadUrlTimeoutValue" value="10000" />
<preference name="InAppBrowserStorageEnabled" value="true" />
<preference name="LoadingDialog" value="My Title,My Message" />
<preference name="ErrorUrl" value="myErrorPage.html" />
<preference name="ShowTitle" value="true" />
<preference name="LogLevel" value="VERBOSE" />
<preference name="AndroidLaunchMode" value="singleTop" />
<preference name="DefaultVolumeStream" value="call" />
<preference name="OverrideUserAgent" value="Mozilla/5.0 My Browser" />
<preference name="AppendUserAgent" value="My Browser" />
<allow-navigation href="http://192.168.0.16:8100" />
<plugin name="cordova-plugin-facebook4" spec="~1.9.1">
    <variable name="APP_ID" value="****" />
    <variable name="APP_NAME" value="****" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
<plugin name="cordova-plugin-fcm" spec="^2.1.2" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
<plugin name="cordova-plugin-camera" spec="~2.4.1" />
<plugin name="cordova-plugin-filepath" spec="~1.0.2" />
<plugin name="cordova-plugin-file" spec="^5.0.0" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.1" />
<plugin name="cordova-plugin-app-update" spec="^1.6.0" />
<plugin name="cordova-plugin-device" spec="^2.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
<platform name="android">
<engine name="android" spec="^6.2.3" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>

我已经遵循了在论坛和堆栈溢出上讨论的一些解决方案,但是我没有得到任何帮助,请提出如何解决这个问题的建议?

$ ionic cordova构建android

Output
build dev started ...
clean started ...
clean finished in 16 ms
copy started ...
.
.
lint started ...
build dev finished in 12.94 s
>ionic cordova prepare
>cordova prepare
Android studio project detected
tslint multiple warning ...
finished building but not build the APK ?

1 个答案:

答案 0 :(得分:-1)

您可以尝试执行以下步骤

ionic cordova platform remove android
ionic cordova platform add android

使用以下命令再次构建项目

ionic cordova build android