科尔多瓦(Cordova)未复制适当的图标和启动画面,使用默认设置,仅Android [英] Cordova not copying appropriate icon and splash, using default, Android only

查看:117
本文介绍了科尔多瓦(Cordova)未复制适当的图标和启动画面,使用默认设置,仅Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序继续使用默认的cordova图标和初始屏幕.挖掘后,应该发生的是将我所有的图标/启动画面都复制到platform/android/res/.当我查看那里时,这只是默认的cordova.但是,在我的resources/android/中,我所有的自定义项都在那里.

My app keeps using the default cordova icon and splash screen. Upon digging, what should happen is all of my icon/splash get copies to platforms/android/res/. When I look in there, it's just the default cordova ones. However, in my resources/android/ all of my custom ones are there.

在iOS上可以正常工作,在Android上不能正常工作.我正在运行Cordova CLI 6.4.0. 我将所有自定义图标和启动图像设置都设置在正确的目录结构中,并且在平台添加或构建android期间未收到任何错误

Working fine for iOS, not fine for Android at. I am running Cordova CLI 6.4.0. I have all the custom icons and splash images setup in correct directory structure, and receive no errors during platform add or build android

下面是我的config.xml

Below is my config.xml

<platform name="android">
    <allow-intent href="market:*" />
    <icon platform="android" src="resources/icon.png" />
    <icon platform="android" qualifier="ldpi" src="resources/icons/android/icon-36-ldpi.png" />
    <icon platform="android" qualifier="mdpi" src="resources/icons/android/icon-48-mdpi.png" />
    <icon platform="android" qualifier="hdpi" src="resources/icons/android/icon-72-hdpi.png" />
    <icon platform="android" qualifier="xhdpi" src="resources/icons/android/icon-96-xhdpi.png" />
    <icon platform="android" qualifier="xxhdpi" src="resources/icons/android/icon-144-xxhdpi.png" />
    <icon platform="android" qualifier="xxxhdpi" src="resources/icons/android/icon-192-xxxhdpi.png" />
    <splash platform="android" src="resources/splash.png" />
    <splash platform="android" qualifier="ldpi" src="resources/screens/android/screen-ldpi-portrait.png" />
    <splash platform="android" qualifier="mdpi" src="resources/screens/android/screen-mdpi-portrait.png" />
    <splash platform="android" qualifier="hdpi" src="resources/screens/android/screen-hdpi-portrait.png" />
    <splash platform="android" qualifier="xhdpi" src="resources/screens/android/screen-xhdpi-portrait.png" />
</platform>

<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="2000" />
<preference name="FadeSplashScreen" value="false" />
<preference name="FadeSplashScreenDuration" value="0" />
<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />

  1. 与iOS完全相同的设置,并且在iOS上可以完美运行
  2. 我已经三遍检查了路径,并且一切都正确,并且我的自定义图标确实在指示的位置,但是在构建过程中并没有被复制
  3. 我已经尝试过几次删除并添加android平台,然后使用cordova-plugin-splashscreen进行构建
  4. 图标和启动屏幕在Android上均无法运行

这是显示文件夹布局和不幸的不正确图像的屏幕截图.

And here's a screencap showing the folder layout, and the unfortunately incorrect images.

更新取得了一些进展,但还不够.我在config.xml中将限定符"替换为密度".现在,它会创建一个看起来正确的"res"文件夹,但会将其放在我项目的根目录中,而不是Platforms/android中.它还创建platform/android/res,但是其中的所有图像都是默认的Cordova图像.如果在构建之前将新文件夹/res(我的自定义图标)移动到/platforms/android(默认cordova图标),则该应用程序将显示我的正确内容.我想这是一个可行的解决方法,但很烦人.我删除了/res文件夹,但cordova平台添加了android构建它,似乎只是在错误的目录中创建了它.

Update made some progress but not quite there. I replaced "qualifier" with "density" in my config.xml. Now what it does it create a correct looking "res" folder, but it puts it in the root of my project instead of platforms/android. It also creates platforms/android/res but all of the images in there are the default Cordova ones. If I move the new folder /res (my custom icons) into /platforms/android (default cordova icons) before build then the app shows my correct stuff. I guess it's a working workaround but an annoying one... and to note; I delete the /res folder but cordova platform add android builds it, just seems to create it in the wrong directory.

推荐答案

这是cordova-android在6.1.0版中解决的一个问题.

This is an issue in cordova-android solved in the version 6.1.0.

建议的步骤是:

cordova platform update android@6.1.0 --save
cordova platform rm android
cordova platform add android

来源: https://github.com/apache/cordova-android/pull/343

这篇关于科尔多瓦(Cordova)未复制适当的图标和启动画面,使用默认设置,仅Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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