Ionic Framework:'ionic resources' 生成没有图标和启动图像的空目录

Ionic Framework: 'ionic resources' generating empty directories with no icon and splash images

我正在使用离子框架版本 1.7.14 创建一个 android 应用程序。我正在尝试按照 here.

中提到的步骤生成图标和启动画面

我在项目的根目录下创建了一个目录 'resources',并在其中添加了 2 张图像:icon.png (192x192) 和 splash.png (2208x2208)。现在当我 运行

$ ionic resources

在resources中生成目录'android',里面有子目录'icon'和'splash'。但是,没有生成图像。所有目录都是空的,构建项目时出现以下错误:

Android project created with cordova-android@5.1.1
cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-ldpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-mdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-hdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xxhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xxxhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-ldpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-mdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-hdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xxxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-ldpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-mdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-hdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xxxhdpi-screen.png

据我所知,您不必创建资源文件夹。它是在您执行以下操作时默认创建的:ionic start myapp [template]

ionic resources --icon(创建图标)

ionic resources --splash(创建启动画面)

您必须替换资源文件夹中的默认 icon.png 和 splash.png,还要确保它们具有正确的指定尺寸。

如果这些都不起作用,请尝试再次删除和添加 android 或 ios 平台。

ionic cordova resources 依赖于 ionic 服务器,可能由于网络问题或 ionic 服务器问题而失败。只需确认图标和启动文件已放入 PROJECT_FOLDER/resources,然后重试。希望这对你有帮助,如果没有,也许你可以重新安装ionic。

你说:

I have created a directory 'resource'

那么这就是你的问题所在。是 resources 而不是 resource

只需将 icon.pngsplash.png 放入资源文件夹和 运行 ionic resources

我遇到了同样的问题。在我的例子中,原因是非二次飞溅图像。 (无缘无故,图形专家让我对 2208x2205 感到震惊)

我将图像更改为 2205x2205 并且效果很好。