简体   繁体   中英

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).

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. Commenting out the three android lines does not help. 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.

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.

The Android docs state (in relation to nine patch files):

It must be saved with the extension .9.png...

I used the nine patch generator here (googlecode.com) that automatically takes a .png and outputs .9.png files.

However, using the .9.png file extension was the issue here. For some reason, the cordova/meteor build process did not handle files already in .9.png format.

Final answer: If using a .9.png generator, rename the files to just .png before adding them to your meteor project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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