mwaylabs / generator-m-ionic

Advanced workflows and setup for building rock-solid Ionic apps
MIT License
670 stars 133 forks source link

android `drawable-*` files copied to wrong `res` directory (icons and splashscreens) #473

Open zachlyon opened 7 years ago

zachlyon commented 7 years ago

When I execute gulp --cordova "run android" the build and run is successful. However, the splash and icon files are not being copied correctly, and I see all of the drawable-* files written into MyProject/res/ directory and not the MyProject/platforms/android/res/ directory. I can manually copy these files to the appropriate directory and it runs fine. But every time I run, MyProject/res/ gets the same injection of android res files.

I have my config.xml setup per the instructions:

<icon density="ldpi" src="res/android/default/icon/drawable-ldpi-icon.png" />

Any ideas? I run another project with the same setup using different icon sets and no problems there. I'm wondering if this is a generator or android versioning issue?

screen shot 2017-01-27 at 1 15 41 pm

gruppjo commented 7 years ago

Hi @zachlyon. That's weird... The copying is done by the gulp task, so it shouldn't matter which android version you have. Can you provide a sample setup that produces this error, which I can clone? That would make it easier to track down what's causing this error.

gruppjo commented 7 years ago

Related to #470 !

Ajaxy commented 7 years ago

same for me here

zachlyon commented 7 years ago

@gruppjo Thanks for keeping this issue open!

I just tried another build and got the same result. I figured I'd try the "remove and re-add android" platform trick again. I noticed this odd "drawable" folder creation happens with gulp --cordova "platform add android --save" too, not just for the build.

So, I did a little more digging and found this thread at Ionic which lead me to this thread on Drifty's Github.

This is what I did to get it to work...

  1. gulp --cordova "platform rm android --save" scrap it and start over...
  2. Write <engine name="android" spec="~6.1.0" /> in config.xml (6.1.0)
  3. gulp --cordova "platform add android" (no --save) that would write <engine name="android" spec="~6.0.0" /> back in my config.xml and have me running in circles again.

I have another project I just published that runs<engine name="android" spec="~5.1.1" /> with no problems. I'm not sure what it is under the hood with 6.0.0 but this worked for me.

< Z >

PS - I also read somewhere that <icon density="ldpi" src="res/android/default/icon/drawable-ldpi-icon.png" /> should be <icon qualifier="ldpi" src="res/android/default/icon/drawable-ldpi-icon.png" /> changing "density" to "qualifier" did make a difference in the drawable folder in res (only two were created) but the assets were still not being copied to the platforms/android folder.

gruppjo commented 7 years ago

Hi @zachlyon, nice! I'm glad you found a solution, or well, rather a "not so nice" fix for this problem. Thanks for sharing it!

Unfortunately, most of this seems related to Cordova, so there's not much I can do to make it easier for you and others. But I will leave this issue open and have a look into why the assets are not being copied correctly, maybe I can do something about that.