Android studio ubuntu create icon

Add an Android Studio icon on Ubuntu

This tip explains two ways to add a desktop icon to launch Android Studio from a Gnome 3 environment: activate or create icons on the desktop.

Prerequisites¶

1/ Activate icons on the desktop¶

Not all environments on Linux allow desktop icons by default and neither does Gnome 3 under Ubuntu 16.04.

To allow icons you should use the gnome-tweak-tool application

First, if gnome-tweak-tool is not available on your system type the following command from a terminal:

$ sudo apt-get install gnome-tweak-tool

Then launch the gnome-tweak-tool application :

Finally, in the menu of the application go to the Desktop section and activate the icons.

Desktop menu of the gnome-tweak-tool application GUI

2/ Create the icon¶

There are two ways to create an icon:

  1. Using a .desktop extension file.
  2. Using a script

A/ Using a .desktop file¶

A.1/ Create an android.desktop file

/Desktop» (can be called differently depending on the language of your environment like «

/Bureau» for French), create a file called android.desktop . In this file put the following text:

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Comment=Android Studio
Exec=/opt/android-studio/bin/studio.sh
Icon=emblem-dropbox-syncing
Path=
Terminal=false
StartupNotify=false

Adapt the code above regarding the Android Studio installation path («Exec» field). On our environment Android Studio application is located in «/opt/android-studio» and the script to launch it is «/opt/android-studio/bin/studio.sh»

A.2/ Authorize file execution

If a message Untrusted application launcher is displayed on executing the script from the desktop, it is necessary to allow the .desktop file to be executed. Proceed as follows:

  • Right-click on the previously icon and select the menu Properties.
  • Select the tab Permissions
  • Tick the Execute box «Allow executing file as program»

View of Desktop icon properties permissions setting

Here you are! A neat icon is now available on your desktop to launch Android Studio.

You can proceed to the lessons of the Developer Center section now or read the Tips and tricks articles around Android Studio use.

View of a desktop with Android Studio icon

B/ Using a script file¶

B.1/ Create a file android.sh

Create a script file on the «

/Desktop» folder, name this file «android.sh» and add the following content:

You could also create a symbolic link to the “studio.sh” script which is located in «/opt/android-studio/bin/studio.sh» on our install.

/Desktop
$ ln -s /opt/android-studio/bin/studio.sh studio.sh

B.2/ Allow script execution

To increase security Gnome does not activate a script files from the graphical environment. You need to allow this execution manually.

  • Use dconf-editor application ( Hit Alt+F2, type dconf-editor and hit Enter );
  • In dconf editor window go to menu org > gnome > nautilus > preferences;
  • On the right window pane select entry executable-text-activation;
  • Click on the field on the right and from the drop-down menu that is displayed select:

    launch to launch scripts as programs

    ask to ask what to do via a dialogue

    View of the dconf-editor window

    Now you have a shortcut on your desktop to launch your Android Studio IDE. Enjoy and explore the lessons of the Developer Center section or read the Tips and tricks articles around Android Studio use.

    View of a desktop with icons

    Add a shortcut in the launcher¶

    If you prefer to access Android Studio from the dash or add an icon as a favourite in the launcher, please read the following article : Add an Android Studio shortcut to the app launcher

    Источник

    3 Methods to create Android Studio launcher in Ubuntu

    Unlike windows operating system, to create a desktop shortcut or launcher menu shortcut its difficult.But there are different ways in Ubuntu to create Android Studio IDE shortcut either from desktop, terminal, or startup launcher in Ubuntu. This will be convenient to open Android Studio instead of navigating to the bin folder of the android studio and hitting the studio.sh icon. In this article we are going to discuss different methods to create Android Studio launcher in Ubuntu.

    Table of Contents

    Create shortcut through bashrc

    bashrc is an interactive shell script command files. This file will have list of the commands, for these commands we can create alias names for it. Later you can run these commands from the terminal by executing alias name. Certainly, we get the path of the android studio’s .sh file. Usually this file is present in the bin folder of the android studio folder in Ubuntu. For instance this is the path of my android studio’s .sh file.

    /home/dell/Development/android-ide/android-studio/bin/studio.sh

    After getting the path of your studio.sh file, open .bashrc file with an editor of your choice. I’m opening it with gedit.

    In the third step of this method, add the path of you studio.sh file at the bottom of the .bashrc file. I have named alias as studio.

    In the final step of this method, you need to reload the bashrc file. Unless you don’t reload the bashrc file you won’t be able to start android studio from the terminal.

    Now just type studio in the terminal – Android studio will be launched for you.

    Create Desktop Shortcut

    In this method we need to create .desktop file and you can place it either on the desktop or in the .local/share/applications folder. A .desktop file is launcher file with set of commands to launch an application. Please note down the path of your Android Studio’s studio.sh file location. However, to demonstrate here we are going to use previous method’s file path of studio.sh .

    Save the above file with android-studio.desktop on the desktop at

    /Desktop path. Then you have to make file executable with the follwing command.

    Create a system menu launcher

    In order to launch the Android Studio from the system menu just save the android-studio.desktop file in ‘

    /.local/share/applications’ location and make the file executable with chmod command. Later on you can launch Android Studio from the start up menu.

    Create Shortcut from Android Studio

    This is the final method in this article, this method is also very simple to create Android Studio launcher shortcut from the Android Studio itself. Open the Android Studio by hitting on the studio.sh file in the android-studio folder. Next navigate to Tools and hit on the Create Desktop Entry to create Android Studio’s launcher shortcut in the system menu.

    Conclusion

    Here we have discussed 3 methods to create Android Studio shortcut in Ubuntu. You can use any of the the methods of your convenience.

    Источник

    How to Create Android App Icons using Image Asset Studio

    Creating an application interface that the user will like and will be unlikely to forget can be intimidating. But creating an attractive launcher icon for your app, that the user will first come across while looking at your app, anyway needs more brainstorming. For Android, you need to create these graphics that have to be compatible and supporting to all devices running Android, sizes varying from a smartphone to TV. The introduction of Android Image Asset Studio in Android Studio has made it easy. In this article, you will see how you can easily create your application icon in one go.

    Image Asset Studio is a tool introduced in Android Studio 3. It can be used to generate app icons for all the screen densities in one go, using custom images, material design icons as well as text strings. Application icon in Android includes the following,

    • Launcher Icon: represents your app and the first thing that user sees
    • ActionBar Icon & Tab Icon: representing actions in the ActionBar and Tabs of the app
    • Notification Icon: represents your app notification when a user is outside your app

    Here is a list of icon/image sizes that you need to create for different screen densities, for each image that you use in your application. No matter if you are a good designer, creating each of these is tedious!

    Image Asset Studio helps to create all these icons for all screen densities and stores them in respective density folders. It provides a preview of all the icons that will be created, in different shapes, with options to edit them. Let’s see how to create each one of them.

    Run Image Asset Studio

    1. In the Project Window, select the project hierarchy.
    2. Right-click on the res folder and choose New -> Image Asset.

    3. Create the icon for your app i.e.

    • Launcher icon which may be Adaptive and Legacy Launcher Icon (if your app supports Android 8.0 or above) or just the Legacy Launcher Icon(for Android version less than or equal to 7.1)
    • ActionBar Icons and Tab Icons
    • notification icon as per your requirement.

    4. You can select the following Asset Type. The icon appears on the right side, in the preview panel.

    Custom Image

    You can use custom images of PNG (recommended), JPG or GIF (avert) format and adjust it to create icons. Set the path of your custom image if you select this.

    Clip Art

    You can select the icons from the list of Google Material Design Icons provided in the dialog. Click on the clip art icon to get the dialog with icon set.

    Text String

    You can use the fonts installed on your computer to generate the icons out of the text strings. It will create these text-based icons in PNG format in respective drawable-density folders. Set the string and select the font to use it.

    If you are comfortable learning from video, you can refer to this for Launcher Icons and App Bar Icons:

    Creating Launcher Icon

    Launcher Icons represent our app in the device home screen, on the app list screen, in the Google Play Store and everywhere else. Android 8.0 (Oreo) and above supports Adaptive Icons and can be displayed in different shapes across various platforms. Image Asset Studio provides the option to create these adaptive icons as well as the legacy icons for Android 8.0 below. It also creates web icons(512 x 512 px) that represents our app on the Google Play Store.

    The Launcher Icons are stored in the res/mipmap-density folder.

    Adaptive and legacy launcher icon

    If your app doesn’t support android version 8.0 or above, create legacy icon only for your app.

    After opening Image Asset Studio, follow the steps below to create the legacy icons for your android app.

    1. For Icon Type field, select Launcher Icons (Adaptive & Legacy).
    2. For Foreground Layer tab, select the Asset type to be an image, clip art or text.
    3. Then for the Background Layer tab, select a Color or set the Image path for the Asset type to set the background.
    4. Then the Legacy tab, check the default settings. You can choose whether you want to generate the legacy icon, round icon and the icon for the web(Google Play Store Icon).
    5. Optionally
    • Name: Change the name of the foreground and background layer. If the resource with the specified name exists, it will be indicated by an error message. The name can contain lowercase characters, digits and underscore only.
    • Trim: Chose yes to adjust the margin between the foreground icon graphic and the background, else select no to keep the source asset as it is.
    • Color: Set the color for the clip art or the text asset. Click the field, select the color, click chose and preview your icon.
    • Resize: Use the slider to resize your icon. It is disabled for background layer where Color is the asset type.

    7. Chose the resource directory for your image asset.

    • main/res: For all source set including debug and release
    • debug/res: For debugging only
    • release/res: For only one version of build, overrides main source set
    • custom source set: To define a new source set File -> Project structure -> app -> Build Types. Refer to Configure Build Variants for details
      Output Directories shows the list of folders in which the icons will be created in the Project view in Project Window.

    Check the mipmap folders for the Launcher Icons.

    Legacy launcher icon only

    If your app supports android version 8.0 or above, create adaptive and legacy launcher icon for your app.

    After opening Image Asset Studio, follow the steps below to create adaptive and legacy icons for your android app.

    1. For Icon Type field, select Launcher Icons (Legacy Only).
    2. Select the Asset type to be an image, clip art or text.
    3. Optionally
    • Name: Change the name of the icon if you don’t want to use the default name. If the resource with the specified name exists, an error message will indicate it. The name can contain lowercase characters, digits and underscore only.
    • Trim: Chose yes to adjust the margin between the foreground icon graphic and the background, else select no to keep the source asset as it is.
    • Padding: Adjust the source set padding for all four sides. You will have the review on the right side.
    • Foreground: Set the color for the clip art or the text asset. Click the field, select the color, click chose and preview your icon.
    • Background: Set the color for the background. Click the field, select the color, click chose and preview your icon.
    • Scaling: Select crop or S hrink to fit to fit the icon size
    • Shape: Select the shape to set a backdrop for the icon. For transparent, select none.
    • Effect: Select dogear if you want the dogear effect for your icon, else select none.

    5. Chose the resource directory for your image asset.

    • main/res: For all source set including debug and release
    • debug/res: For debugging only
    • release/res: For only one version of the build, overrides main source set
    • custom source set: To define a new source set File -> Project structure -> app -> Build Types. Refer to Configure Build Variants for details

    Check the mipmap folders for the Launcher Icons.

    Creating ActionBar Icons and Tab Icons

    ActionBar icons are the ones present on the ActionBar that represents individual action. Whereas, the tab icons are used in the apps having multiple tabs. Using material icons for this category is recommended.

    The ActionBar and Tab Icons are stored in the res/drawable-density folder.

    You can also use Vector Asset Studio to have XML vectors for these categories of icons. It will reduce the size of your APK considerably.

    After opening Image Asset Studio, follow the steps below to create action bar and tab icons for your android app.

    1. For Icon Type field, select Action Bar and Tab Icons.
    2. Select the Asset type to be an image, clip art or text.
    3. Optionally
    • Name: Change the name of the icon if you don’t want to use the default name. If the resource with the specified name exists, an error message will indicate it. The name can contain lowercase characters, digits and underscore only.
    • Trim: Chose yes to adjust the margin between the foreground icon graphic and the background, else select no to keep the source asset as it is.
    • Padding: Adjust the source set padding for all four sides. You will have the review on the right side.
    • Theme: Select holo_light or holo_dark as per your app theme. Select custom to set a custom color for the icon.

    5. Chose the resource directory for your image asset.

    • main/res: For all source set including debug and release
    • debug/res: For debugging only
    • release/res: For only one version of build, overrides main source set
    • custom source set: To define a new source set File -> Project structure -> app -> Build Types. Refer to Configure Build Variants for details

    Check the drawable folders for the Icons created.

    Creating Notification icons

    To learn from the video:

    The user sees the notification when he is outside your app. Notification icons come up with these notifications.

    The Notification Icons are stored in the res/drawable-density folder. There are a few other folders created too.

    • for Android 2.2 (API 8) or lower — icons stored in res/drawable-density
    • for Android 2.3 to 2.3.7 (API 9 & 10) — icons stored in res/drawable-density-v9. Gray version of the icon is created
    • Android 3 (API 11) or higher — icons stored in res/drawable-density-v11. A white version of the icon is created.

    After opening Image Asset Studio, follow the steps below to create notification icons for your android app.

    1. For Icon Type field, select Notification Icons.
    2. Select the Asset type to be an image, clip art or text.
    3. Optionally
    • Name: Change the name of the icon if you don’t want to use the default name. If the resource with the specified name exists, an error message will indicate it. The name can contain lowercase characters, digits and underscore only.
    • Trim: Chose yes to adjust the margin between the foreground icon graphic and the background, else select no to keep the source asset as it is.
    • Padding: Adjust the source set padding for all four side. You will have the review on the right side.

    5. Chose the resource directory for your image asset.

    • main/res: For all source set including debug and release
    • debug/res: For debugging only
    • release/res: For only one version of build, overrides main source set
    • custom source set: To define a new source set File -> Project structure -> app -> Build Types. Refer to Configure Build Variants for details

    Check the drawable folders for the Icons created.

    How to Delete an App Icon from a project

    To delete the app icon,

    1. Select Android View in Project Window
    2. Expand the mipmap and drawable folder for the launcher and other icons respectively.
    3. Select the sub-folder that matched the name of your icon. It contains the icons of all densities that you created.
    4. Right-click on the sub-folder and hit delete.
      Dialog for Safe Delete appears.
    5. If you want, select options to find the places where the icon is used and hit OK.
      If you chose to search for usage and the icon has any use in the project, you can view it and then confirm delete. You should delete or replace this reference to successfully compile the project. Android Studio then deletes the file from the project and the drive.
    6. Chose Build -> Clean Project.

    Источник

    Читайте также:  Обновление до 10 андроида хуавей когда
Оцените статью