离子框架:'离子资源'生成没有图标和启动图像的空目录

时间:2016-03-13 11:02:39

标签: android cordova ionic-framework ionic-cli

我使用离子框架版本1.7.14来创建一个Android应用程序。我正按照here提到的步骤尝试生成图标和启动画面。

我创建了一个目录' resources'在我的项目的根目录并添加了2个图像:icon.png(192x192)和splash.png(2208x2208)。现在我跑的时候

$ ionic resources

它会生成目录' android'在资源中使用子目录' icon'和'泼水'在里面。但是,没有生成图像。所有目录都是空的,我在构建项目时遇到以下错误:

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

4 个答案:

答案 0 :(得分:3)

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

离子资源 - 图标(创建图标)

离子资源--splash(创建启动)

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

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

答案 1 :(得分:2)

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

答案 2 :(得分:0)

你说:

  

我创建了一个目录'资源'

然后这就是你的问题所在。它的resources不是resource

只需将icon.pngsplash.png放在资源文件夹中,然后运行ionic resources

答案 3 :(得分:0)

我遇到了同样的问题。在我的情况下,原因是非二次飞溅图像。 (无论如何,这个图形家伙让我对2208x2205感兴趣)

我将图像更改为2205x2205,而不是正常工作。