gpt4 book ai didi

react-native - 在哪里放置我的图标图片供世博会使用而不是默认图片?

转载 作者:行者123 更新时间:2023-12-05 02:14:01 25 4
gpt4 key购买 nike

根据世博会文件:

The most straightforward way to provide an icon for your app is to provide the icon key in app.json

所以我在 expo 默认图标所在的 assets 文件夹中添加了我自己的图标,并修改了 app.json 以指向我的图标:

  "expo": {
...
"icon": "./assets/myIcon.png"
}

但是启动时我从 expo 收到这个错误:

Field: icon - cannot access file at './assets/myIcon.png

我错过了什么?我应该把我的图标图片放在哪里?

已解决通过运行 expo start -c 来清除缓存。*注意:我花了几分钟才与我的 expo 客户端应用同步!

最佳答案

根据我与发问者 (@Blue Turtle) 的对话,我可以从中得出一些结论。

图片大小

重要的是要确保您用于图标的图像必须是完美的正方形。如果不是Expo会报类似下面的错误

Error: Problems validating asset fields in app.json. See https://docs.expo.io/
• Field: icon - image should be square, but the file at './assets/icon.png' has dimensions 1242x2436.

文档建议您使用大小为 1024x1024 https://docs.expo.io/versions/latest/workflow/configuration/#icon 的图像

Local path or remote url to an image to use for your app's icon. We recommend that you use a 1024x1024 png file. This icon will appear on the home screen and within the Expo app.

清除缓存

此外,在更新 Assets 等时,建议关闭并重新启动您的 bundler ,使用以下命令重新启动 expo start -c。以这种方式启动 bundler 将确保您的缓存被清除,并且您对包、 Assets 等所做的任何更改都将被执行,并且您将希望遇到更少的错误。

关于react-native - 在哪里放置我的图标图片供世博会使用而不是默认图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54399166/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com