简体   繁体   English

流星运行android设备失败:如何正确定义launchScreens

[英]Meteor run android-device failing: How to correctly define launchScreens

Trying to change the default splash screen on my meteor app. 尝试更改流星应用程序上的默认初始屏幕。 Running meteor run android-device produces a long error message (see relevant section below). 运行meteor run android-device会产生一长条错误消息(请参阅下面的相关部分)。

From what I gather, it seems the three nine patch files are being referenced twice...but I have no idea how to de-reference them. 据我所知,似乎三个引用了九个补丁文件……但是我不知道如何取消引用它们。

The app worked before I added the following to my mobile-config.js and added the actual image files. 在我将以下内容添加到mobile-config.js并添加了实际的图像文件之前,该应用程序正常运行。 Commenting out the three android lines does not help. 注释掉三个android行无济于事。 Deleting the nine patch files will also not help. 删除九个补丁文件也无济于事。

App.launchScreens({
  'android_xhdpi_portrait':'splash/xhdpi.9.png',
  'android_hdpi_portrait':'splash/hdpi.9.png',
  'android_mdpi_portrait':'splash/mdpi.9.png',
  'ipad_portrait_2x':'splash/ipad_portrait_2x.png',
  'ipad_portrait':'splash/ipad_portrait.png',
  'iphone_2x':'splash/iphone_2x.png',
  'iphone5':'splash/iphone5.png',
  'iphone6':'splash/iphone6.png',
  'iphone6p_portrait':'splash/iphone6p_portrait.png'
});

I'm quite sure the images only exist in the directory once. 我很确定图像只在目录中存在一次。 I know the path is correct because the ios splash images work perfectly. 我知道路径是正确的,因为ios初始图像可以完美工作。

Here is the relevant piece of console output: 这是相关的控制台输出:

res/drawable-port-mdpi-v4/screen.png:0: error: Resource entry screen is
   already defined.
   res/drawable-port-mdpi-v4/screen.9.png:0: Originally defined
   here.

   res/drawable-port-hdpi-v4/screen.png:0: error: Resource entry screen is
   already defined.
   res/drawable-port-hdpi-v4/screen.9.png:0: Originally defined
   here.

   res/drawable-port-xhdpi-v4/screen.png:0: error: Resource entry screen is
   already defined.
   res/drawable-port-xhdpi-v4/screen.9.png:0: Originally defined here.

The meteor docs state: 流星文档指出:

For Android, launch screen images should be special "Nine-patch" image files that specify how they should be stretched. 对于Android,启动屏幕图像应为特殊的“九补丁”图像文件,用于指定应如何拉伸它们。

The Android docs state (in relation to nine patch files): Android文档状态(与九个补丁文件有关):

It must be saved with the extension .9.png... 必须以.9.png扩展名保存。

I used the nine patch generator here (googlecode.com) that automatically takes a .png and outputs .9.png files. 我在这里使用了九个补丁生成器(googlecode.com),该生成器自动获取.png并输出.9.png文件。

However, using the .9.png file extension was the issue here. 但是,这里的问题是使用.9.png文件扩展名。 For some reason, the cordova/meteor build process did not handle files already in .9.png format. 由于某些原因,cordova / meteor的构建过程无法处理.9.png格式的文件。

Final answer: If using a .9.png generator, rename the files to just .png before adding them to your meteor project. 最终答案:如果使用.9.png生成器,则将文件重命名为.png,然后再将其添加到流星项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM