I'm using ionic to generate resources (icon and splash). I'm using ionic v2.1.0 and cordova v6.4.0.
Until now I've been using (it was working in previous versions):
cordova platform add android
ionic resources
This was adding android with this version:
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: ...
Name: ...
Activity: MainActivity
Android target: android-24
Subproject Path: CordovaLib
Android project created with [email protected]
In previous cli versions, ionic resources was generating corresponding entries in config.xml and the resources were placed correctly.
But after upgrading cordova and/or ionic cli, the resources for android have not being copied, so icon and splash remain as cordova ones. I've seen this thread and it says to remove android platform and then use this command:
cordova platform add android@latest
So this adds this platform:
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: ...
Name: ...
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with [email protected]
And successfully copies the icons and splash. The problem is that this creates an extra res folder:
├── bower.json
├── config.xml
├── gulpfile.js
├── hooks
├── ionic.config.json
├── node_modules
├── package.json
├── platforms
├── plugins
├── res
│ ├── drawable-land-hdpi
│ ├── drawable-land-ldpi
│ ├── drawable-land-mdpi
│ ├── drawable-land-xhdpi
│ ├── drawable-land-xxhdpi
│ ├── drawable-land-xxxhdpi
│ ├── drawable-port-hdpi
│ ├── drawable-port-ldpi
│ ├── drawable-port-mdpi
│ ├── drawable-port-xhdpi
│ ├── drawable-port-xxhdpi
│ ├── drawable-port-xxxhdpi
│ ├── mipmap-hdpi
│ ├── mipmap-ldpi
│ ├── mipmap-mdpi
│ ├── mipmap-xhdpi
│ ├── mipmap-xxhdpi
│ └── mipmap-xxxhdpi
├── resources
├── scss
└── www
So my question are:
res folder?res folder?cordova prepare)resources folder if both need to be the same. Add them to resp. resources/android and resources/ios in stead if they need to be different. And then run ionic resourcesSee below for the solution:
You updated to the latest version of Cordova, but not to the latest version of Android platform. Do this to update to version 6.1.0:
cordova platform update [email protected]
After that the resources will be uploaded to the res directory in platforms/android and you can safely remove the res directory from your project root.
Edit
This issue has been fixed in Cordova 6.5.0.
Update your project to Cordova 6.5.0 using following commands.
npm install -g cordova
If you already have the project built using cordova earlier version you have to update the android platform of your project.
cordova platform update [email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With