首页 > 解决方案 > 离子科尔多瓦资源——强制不起作用

问题描述

在添加 android/iOS 平台或运行ionic cordova resources --force此未完成时,始终在生成平台资源步骤中继续停止。

我验证了这一点,同时这会在 api 调用(https://res.ionic.io/api/v1/transform)上产生503错误。

我检查了离子状态(https://status.ionicframework.com/),但在那里,所有系统都正常运行。

编辑

我的ionic info

Ionic:

   ionic (Ionic CLI)  : 4.0.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0

System:

   NodeJS : v10.6.0 (/usr/local/bin/node)
   npm    : 6.1.0
   OS     : macOS High Sierra
   Xcode  : Xcode 9.2 Build version 9C40b

我的package.json

"dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "^4.10.1",
    "@ionic-native/header-color": "^4.10.1",
    "@ionic-native/local-notifications": "^4.10.1",
    "@ionic-native/qr-scanner": "^4.10.1",
    "@ionic-native/social-sharing": "^4.10.1",
    "@ionic-native/splash-screen": "^4.10.1",
    "@ionic-native/status-bar": "^4.10.1",
    "@ionic/cli-utils": "^2.0.1",
    "@ionic/storage": "2.1.3",
    "cordova-android": "^7.1.1",
    "cordova-ios": "^4.5.5",
    "cordova-plugin-add-swift-support": "^1.7.2",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-headercolor": "^1.0.0",
    "cordova-plugin-ionic-webview": "^2.0.1",
    "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-qrscanner": "^2.6.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.1",
    "es6-promise-plugin": "^4.2.2",
    "ionic-angular": "^3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionicons": "^4.2.5",
    "ng-svg-icon-sprite": "^0.8.0",
    "rxjs": "^5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
},
"devDependencies": {
    "@ionic/app-scripts": "^3.1.11",
    "typescript": "2.6.2"
}

ionic -v的是CLI PRO 4.0.1

编辑 2

有些时候,进程返回错误(倍数),例如:

Generating platform resources - failed!
[ERROR] Resource server responded with an error.

    This could mean the server is experiencing difficulties right now--please try again later.

    Request: POST https://res.ionic.io/api/v1/transform
    Response: 400

有这个问题的人吗?建议?

标签: cordovaionic-frameworkionic2ionic3

解决方案


该问题很可能与使用的图像大小有关,而不是与 force 命令本身有关。

确保您的图标具有以下最小尺寸(1200×1200 像素)

并且您的启动画面具有以下最小尺寸(2732×2732 像素)而不是(2208×2208 像素)。

使用以下任一命令生成资源

$ ionic cordova resources 
$ ionic cordova resources ios
$ ionic cordova resources android 

推荐阅读