Replace the launch icon from the command-line (Android studio) - android

I have an app in android studio. I created a launcher icon with a foreground and background PNGs. This works fine.
Now I want to clone this app to make a white-label version for a customer. Change name, some behavior, colors, etc. I have a bash script that does that nicely for me. I can even inject a Java class to modify behavior. Then I build and ship.
The problem I am having is with the launcher icon. When I first created it in Asset Studio, I just selected the background image, the foreground image. It then generated those images in multiple formats. For example, with xxhdpi:
$ ls ./app/src/main/res/mipmap-xxhdpi/
ic_launcher_background.png ic_launcher_foreground.png ic_launcher.png ic_launcher_round.png
The background and foreground images are just resized versions of my resources, but the two other files are "rendered" versions of my icon, one square and one rounded. I am for now overriding them with ImageMagick, but I feel that's not the way to do it.
My question is: Is it possible to replace the background and foreground and have Android Studio regenerate the "rendered" versions of the icons from the command-line ?

Related

Android App Icon Issue

I recently made an app for android using android studio and set the icon and put it on my phone.
The problem is in the app list the icon appears as the android logos face, but when I manage the app, the icon is correct, and when on my phone I look at the apk its also correct.
Only on the app list is it incorrect.
What I've checked so far is:
Right Click the folder system, New > New > Item asset.
Set this as the application app and the image i want.
Also in the AndroidManifest.xml I've also set the
android:icon="#drawable/ic_launcher"
and on the left, the little image appears.
Any other idea's would be appreciated.
Thanks
If any other info is needed please let me know.
android:icon="#drawable/ic_launcher"
instead of ic_launcher put your drawable name in manifest
Check that you have created app icons for all different DPI's. If you check in your res folder there will be multiple drawable folders, suffixed with the different DPI's such as hdpi, xhdpi etc.
You will have to create versions of your icon for each of the different sizes as the OS will pull the most relevant size for what it needs to display at the time, small ones for the manage app's list, larger ones for your launcher.
There's a handy web tool to do this
http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
As a side note, the lastest android studio and the above web tool uses a mipmap folder rather than drawable for application icons, you can either just copy the images into their relevant drawable folders or change your manifest to use the #mipmap prefix.

How to change default app icon shape in Android Studio

I started using Android Studio recently and I found one thing different (notably) that unlike in Eclipse, Android Studio does not provide any option to choose app icon and its shape & size while creating a new app.
While finalizing my app development I tried to change default 'ic_launcher.png' with my own image but I am not able to change its shape (which is square by default) to circular.
So my question is - Is there any way of changing app icon shape in Android Studio ?
And if this question is already been solved on some other thread then please share that link with me. (P.S.- I tried to search with similar question here but couldn't find probable solution, therefore posting this question on my own)
Just add new Icons in all drawable folder and update the icon name in manifest file.
To change the icon shape following tool can be usefull:
http://romannurik.github.io/AndroidAssetStudio/
Sorry for the late answer first of all. Here is my answer:
While launching Android Studio 1 RC in Beta Channel, they did not add this feature of adding image assets to the app directly from the Android Studio.
But since Android Studio 1.1 update, this feature is available to use.
Here is how you get different icons:
Click on res under app directory of you project.
New --> Image Asset
Choose Asset Type (Launcher Icon | Action Bar and Tab Icons | Notification Icon).
Choose your Image from the directory and perform other necessary changes to get the icon you desire.
Click next and then select
Type Module and Res Directory and click Finish.
You will see your icons under res folder directory.
I hope this was helpful, thank you!

Setting Icons For Android Application

So when I start a small application for Android, (I'm Using Eclipse if that matters) I give my application a name, minimum SDK and such. Then, when it comes down to picking a launcher icon, I created an icon with 1024 x 1024 pixels using Adobe Illustrator (if I'm clearly doing something wrong say so) and export it to .png file.
When I build my android application project, the icon is copied into the different drawable folders (mdp, hdp, xhdp...). So my question is does Eclipse already change the dp of my icon to match the different size screens? And my second question is when I add other icon (not the launcher) do I have to manual change the dp and add it to the corresponding drawable folders.
Sort of. It's not best practice to use the set of icons automatically created by Eclipse, for the very reason you mentioned. Highest quality is always manually creating the images via photoshop/fireworks/your preferred image software following these guidelines:
http://developer.android.com/design/style/iconography.html

Android: Limit scalable drawables like icon to one file

Previously I made some apps with Adobe Flash Builder. That's works great but is not the best choice is some cases so I start with developing Android apps with use of ADT.
Like in Flash Builder you can set several icons for different screen resolutions. I can understand why but found it is not really necessary when creating one high resolution icon, this works fine (scaling down is better than scaling up). This also avoid the extra work that is needed to create these icons, just one icon.
Long story short, I want to create just one icon, 144x144 pixels at 96dpi and tell Android to use this icon.
Also I want to point the application icon to the asset directory instead of the res/drawable directory. The reason for this is that the icon can be reused by the (web-)application and for another reason, I have made a webApp tool to create a compressed version of a webApp and put the contents in the asset directory of a Android project.
Because the webApp can also run in the browser I have already created some icons (like favicon, apple-touch-icon and apple-touch-startup-image) and want to reuse these icons in the Android project automaticly.
The idea is also to create an application project template so it is quite easy to create a android app of a webApp.
Question
Andy idea how to change the location of for example the application icon? Using a path doesn't work (it generates an error, can't compile).
android:icon="#drawable/ic_launcher"
android:icon="assets/appicon.png" #<- doesn't work
Actually found the solution myself and is pretty simple. The only thing that is a bit tricky in ADT to validate the new declaration because at first 'it says' that the declaration is invalid. The workaround is to cut (ctrl+X) the declaration, do a project clean by Project|Clean and then put it back by paste it again (ctrl+V). Weird but true ;-)
You can declare a string resource like this (in XML file):
<resources>
<string name="app_icon">assets/appicon.png</string>
</resources>
android:icon="#string/app_icon" <- this works
Then you can use just one high-res icon image as icon for all devices! Looks great! See also picture below (between red rectangle ;-)):

Can Eclipse automatically generate different DPI images for Android projects?

I'm trying to import a 600x600 PNG I made into my Android project so that I can use it as a full-sized image in an Activity. Dragging and dropping it onto my /res folder just puts it in that folder, which of course generates an "invalid resource directory name" error.
I can drop it into any of the /res/drawable folders and that works fine, except then it's only in that one folder.
Surely, there's an inbuilt tool which can take my image and scale it appropriately for each /res/drawable folder.
AFAIK there isn't.
What you can do though, is use the drawable-xhdpi folder only. Android will automatically scale down for lower dpi.
The only exception is the launcher icon. You will have to provide all sizes (don't forget xxhdpi for tablets!).
You can find the needed sizes in the Icon Design Guidelines.
It is important to note that the ADT plugin does have tools for generating some icons sets, such as Launcher icons, Actionbar icons and Notification icons.
These tools can be accessed by opening the New wizard (Ctrl + N) and double-clicking Android Icon Set in the Android category.
there's an inbuilt tool which can take my image and scale it appropriately for each /res/drawable folder.
For the scaling part, check out the Icon Generators Tools # Android Asset Studio. There are tools for generating Launcher icons, Tab icons, Action bar icons and (in your case) Generic icons.
Luckily this changed - you are now able to autogenerate different densities - take a look at:
https://code.google.com/p/android-drawable-converter/
If you put your drawable resources in /res/drawable, that resource will be used for all devices.
However, it probably won't do exactly what you want. I would recommend scaling the assets yourself. If that isn't a viable option, then you are stuck with letting Android do the scaling for you.

Categories

Resources