离子科尔多瓦资源–无法使用

时间:2018-07-26 21:47:19

标签: cordova ionic-framework ionic2 ionic3

在添加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

有人遇到这个问题吗?有建议吗?

5 个答案:

答案 0 :(得分:1)

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

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

,您的启动画面具有以下最小尺寸(2732×2732 px),而不是(2208×2208 px)。

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

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

答案 1 :(得分:0)

正在寻找有关Ionic4的答案的人。

1)如下全局安装cordova-res:

   npm i -g cordova-res

2)运行

   ionic cordova resources

3)它将在资源文件夹中创建启动画面和图标图像。

答案 2 :(得分:0)

就我而言

[https://tinypng.com/

在资源文件夹中,我更改图标大小

图标从106 Kb降至25 Kb

$ ionic cordova resources ios
$ ionic cordova resources android

解决了我的问题

答案 3 :(得分:0)

我通过以下命令更新了Ionic CLI后解决了上述问题:-

npm i -g ionic @ latest

答案 4 :(得分:0)

在将android添加到新的ionic项目中时,我在Windows系统上遇到了同样的问题。

我得到的错误如下: something went wrong installing the sharp module

经过研究,我找到了解决方案,那就是

  1. npm uninstall -g cordova-res
  2. npm i -g cordova-res

希望这会有所帮助