错误:构建离子时,android图标png不存在源路径 [英] Error: Source Path does not exist for android icon png when building for ionic

查看:919
本文介绍了错误:构建离子时,android图标png不存在源路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Your system information:

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
OS: macOS Sierra
Node Version: v6.9.5
Xcode version: Xcode 8.2.1 Build version 8C1002

我正在尝试使用离子平台添加android 来创建一个android项目,但它总是抱怨 resources / android / icon / drawable-hdpi-icon.png 不存在。事实上它没有 - 这些资源都不存在。它们可以通过离子资源创建。

I am trying to use ionic platform add android to create an android project, but it always complains that resources/android/icon/drawable-hdpi-icon.png does not exist. In fact it doesn't -- none of these resources exist. They can get created by ionic resources.

然而如果我尝试运行离子资源没有平台,我被告知先添加平台。这导致我基本上做了类似的事情:

However if I try to run ionic resources without the platform, I am told to add the platform first. This leads me to essentially do something like:

ionic platform add android
ionic resources
ionic platform rm android
ionic platform add android

然后它正常工作。在添加平台之前,我有什么办法可以确保资源得到正确构建或引用吗?

Then it works properly. Is there anything I can do to make sure the resources get properly built or referenced before adding the platform?

推荐答案

这实际上不得不做我的配置。如果您未在配置中指定平台, platform add 将为您创建一个平台。这会自动包含可能不存在的资源路径。

This actually had to do with my configuration. If you don't specify the platform in your configuration, platform add will create one for you. This automatically includes paths to resources that may not be there.

更新config.xml以包含平台;即使它是空的:

Update your config.xml to include the platform; even if it is empty:

<platform name="android"/>
<platform name="ios"/>

然后, platform add 将不会更新配置中的平台,并寻找可能不存在的资源。不过,你仍然应该做离子资源来生成它们。

Then, platform add will not update the platform in the config and look for resources that may not be there. You still should do ionic resources to generate them after the fact, though.

这篇关于错误:构建离子时,android图标png不存在源路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆