How to set icon in Cordova? - android

I know this question gets asked a lot, and I'm still having trouble getting the icons to show in my app on ios and android after upgrading my platforms.
cordova --version | 9.0.0 (cordova-lib#9.0.1)
cordova platforms | android 8.1.0 ios 5.0.1
Following this https://cordova.apache.org/docs/en/latest/config_ref/images.html my first attempt was to add: <icon src="res/icon.png" /> After building the app I see the images Images.xcassets/AppIcon.appiconset. But the images do not take in the app.
Next I generated all the necessary icon sizes and loaded them in res/icon/android and res/icon/ios and then added the following the icon references to the config.xml from the guide above.
Run cordova build ios and then I see the images Images.xcassets/AppIcon.appiconset folder. However still my icon is not set when I run the app in the simulator.
When I run cordova build android I get a build error: AAPT: error: resource mipmap/ic_launcher (aka com.project.mine:mipmap/ic_launcher) not found.
Any ideas?
Edit: If I got into Xcode General -> App Icon Source and click the arrow to access App Icon. I see the option to manually drag all my icons to the right spot. I see all my icons have a warning: "The app icon set "AppIcon" has 22 unassigned children". It looks like I can resize my images manually and drag them correctly.
I'm wondering if there is a automatic way to do this?

Next I generated all the necessary icon sizes and loaded them in res/icon/android and res/icon/ios and then added the following the icon references to the config.xml from the guide above.
Did you do that by hand? 😱
There's a package that does it all for you.
npm install -g cordova-res
cordova-res
You need the following file structure:
resources/
β”œβ”€β”€ icon.png
└── splash.png
config.xml
Also: in Android, the icon is cached sometimes. You have to either restart your launcher or the phone. (maybe cleaning the app cache works too)

Related

cordova-icon utility throws error "spawn convert ENOENT"

I'm developing an Android/iOS Cordova app. Given the sheer number of icons I should manually create and set into the config.xml, I decided to user this nice tool cordova-icon. It isn't a Cordova plugin, it's just an npm tool which takes your icon.png 1024x1024 and creates all the icon set for Android and iOS, plus it sets the appropriate configuration inside the config.xml file.
Unfortunately I get this error:
And I have no idea why. The icon.png is found, the config.xml is found. Platforms Android and iOS are also found.
I just found the error, I didn't have the image-magick library installed.
I simply had to install it...
$ brew install image-magick
... and then it worked
For one reason or another, that plugin stopped working for me, so I've since switched to app-icon and it has worked like a charm!

Ionic - Update splash screen doesn't work

I have an ionic app with version 3.12.0 and I'm trying to update the app icon and splash.
I put icon.png and splash.png in resources folder and run:
ionic cordova resources --icon
ionic cordova resources --splash
And it just update the icon and not the splash. In splash shows the old.
After that I remove the android and ios folder from resources and run:
ionic cordova resources
It create well all both folders again with correct icon but with old splash. How can I solve this?
In all commands that I run show me this warning and I don't know if it can be the reason for that, I think not because the icon was well generated and updated.
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying
./bower.json.
Thank you
Try this command:
$npm rebuild node-sass --force
after generating splash and icon.
from https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
"App on target may not reflect changes to images Once you run the app on a target, iOS caches the launch image. Unfortunately, when you change the image, iOS does not invalidate the cache, which means you'll still see the old launch image. You should either: delete the app, or reset content & settings (simulator)."

Ionic no splash and icon after SDK update

I didn't change anything except updating the SDK. After I removed and added the platform, it builds with default ionic icon and splash.
I tried also making a new project, and generating only splash and icon for it, and same thing happens...images get generated, they are in folders they need to be, and paths in config are right.
Does anyone have a suggestion?
EDIT: Everything gets compiled with JDK 1.8.0_101
check out this link:
https://github.com/driftyco/ionic-cli/issues/1608
and specifically florentsuc's comment
i solved it by running:
ionic platform remove android
ionic platform add android#6.1.0

Ionic app icon doesn't change

I'm building an android app with Visual Studio 15 Community, Ionic and Apache Cordova and I would like to update the icon of my ionic app. I'm emulating the app with Genymotion but I get the same result using the build-in android emulator from VS15.
Additionally, I used a blank ionic project.
I've already tried
I added the source of my icon in the config file (please note that I added the density myself, it has not been generated)
<icon src="resources/android/icon/icon.png" density="xxxhdpi" />
Created the app logo based on this blueprint:
http://ionicframework.com/docs/cli/icon-splashscreen.html
Placed the .png file in the specific folder
I followed the instructions from the ionic and visual studio website
with no results.
I didn't try
Actually, I didn't try to execute the command to update my ressources using $ ionic resources --icon because I think that as soon as I build the app (pressing the play button in VS15) it does all the work for me
Maybe I'm getting something wrong here because usually this isn't a big deal.
I really appreciate all your answers, thank you for taking the time to deal with this!
As of the latest updates. if the splash and the icon did not update. that is because the latest version of ionic creates 2 md5 files of the icon and the splash. which i guess is locking the updates.
just delete these 2 files: β€œicon.png.md5” and β€œsplash.png.md5”.
then run the following command : ionic cordova resources
then splash and the icon should be updated.
might be helpful to someone out there cheers!!
Density is set to "xxxhdpi" density. Maybe you need to add another screen options?
Try to refresh project, too.
As mentioned earlier by a user whos post has been deleted (why?), all I had to do was to
open my command line
go to the directory in which my project is
type the command $ ionic resources
That's it! Ionic does all the rest
A quick note: I didn't know that I had to install the tools (Android SDK, Apache Cordova etc.) because I thought that Visual Studio downloads them due to the first build so why installing it locally. You must install them locally, it will not work without the tools installed on your machine.
Hope I could help

Cordova - run app in device and icon

When I run
cordova run android
in my cordova project, it installs ok the app in the device. But the icon used is still the default one from cordova, not the one defined in config.xml (in the root folder
For testing, I changed all the original icon.png in /platforms/android/res folders, changing it to the one I want, but the installed app still uses the old one.
Is this the normal behaviour? When the final .apk is built, the package will use the right icon? Or is this my fault?
Running cordova 3.5
UPDATE: found the answer here Generating iOS and Android icons in Cordova / PhoneGap
Using the module https://github.com/AlexDisler/cordova-icon help to copy icons to th write folder(s)

Categories

Resources