How to troubleshoot Android Studio |  Android | Developers  Android Developers

Posted on

This page provides assistance for troubleshooting common and configuration issues in Android Studio.High-density displays

Starting with version 1.5, Android Studio provides support for high-density displays (such as Retina and HiDPI monitors) across all platforms. Configuring the scale factor

Android Studio determines the sizing factor for your screen as follows:MacFor Retina displays, UI elements receive a 200% sizing adjustment and images are presented in high resolution. You shouldn’t see blurry images due to sizing, even in multi-monitor settings. Please note that there is no support for scale factors other than 100% (for non-Retina displays) and 200% (for Retina displays). WindowsAndroid Studio uses the DPI settings on the main screen to determine the scaling factor of UI elements. In the case of images, if the factor is less than 150%, the images with normal resolution will be enlarged. If the factor exceeds 150%, the high-resolution images will be adjusted accordingly. LinuxTo determine the scale factor, Android Studio considers the “text scaling factor” and then the DPI settings of the XWindow system.

A DPI configuration with the value 96 corresponds to a scale factor of 100% (without scale), while one of 192 corresponds to a scale factor of 200% (the size of the UI elements is doubled). Currently, Android Studio supports DPI configurations from 96 (100% scale) to 288 (300% scale). If Android Studio doesn’t detect the correct system DPI settings on your Linux or Windows machine, you can set this value manually. To do this, set the hidpi property in the idea.properties file as described in How to Customize Your IDE Properties. Note that this property has no effect on Mac machines.It works as follows:hidpi=trueSets the DPI value to 192 (200% scale) and ignores the system settings.hidpi=falseSets the DPI value to 96 (100% scale) and ignores the system settings. Blurred or pixelated elements on high-density displays

If one or more elements of the Android Studio UI look blurry or pixelated on your high-density screen, you might experience one of the following issues:If most of the Android Studio UI looks good, but a particular icon is blurry or pixelated, or a particular element of that interface uses a font of the wrong size, chances are that that specific element hasn’t been fully updated to support HiDPI yet. Click Help > Submit Feedback to report a bug. Include a screenshot and as much information as possible about your system settings.If you’re using a Linux or Windows machine, and the screen uses a size adjustment factor that is not 100% or 200%, images may be slightly blurred due to that sizing adjustment.If you’re using a Windows machine and you’ve changed the font size in Control Panel, it might look blurry or pixelated. To resolve this issue, log out of the account in Windows and log in again.In a multi-monitor setup running Windows 8.1 or later, if you move a window from one screen to another with a different resolution or DPI value, you might experience issues with the font or image (see error 186007). At the moment, we do not have a known solution for this problem.Versions prior to JRE 1.8 had an issue with blurred fonts (in particular, JRE 1.8.0_25-b18 amd64; see error 192316). Starting with version 2.2, Android Studio introduces a grouped version of the latest supported JDK, which includes the JDE. To resolve this issue, upgrade Android Studio to version 2.2 or later and start using the built-in JDK by clicking File > Project Structure > LOCATION SDK and selecting the Use embedded JDKcheck box.Incorrectly sized items on high-density displays

If the entire Android Studio UI is incorrectly sized on a high-density screen, see Set the scale factor. If some android Studio UI items are incorrectly sized on a high-density screen, but others are the right size, you might experience one of the following issues:If you use a custom editor scheme, the editor font may seem too small or too large compared to the rest of the elements in that UI on a high-density screen. To fix this issue, click File > Settings, and then click Editor > Colors and Fonts > Font to change the font size of the editor. Note that when the default schema is active, the editor font size is automatically adjusted (see error 186920).If some items in the Android Studio UI are the right size, but others are too small or too large, you might experience issue 186923.Click Help > Submit Feedback to report an error. Include a screenshot and as much information as possible about your system settings.Project synchronization issues

When you try to sync your project, you may receive the following error message: “Connection to the Internet denied. (‘Permission denied: connect’)”. You can remove this error message by adding the system property -Djava.net.preferIPv4Stack=true to your gradle.properties file in Android Studio as follows:Open the gradle.properties file in Android Studio.Add the following line to the file:org.gradle.jvmargs=-Djava.net.preferIPv4Stack=trueNote that if you’ve already added other Gradle JVM arguments to your gradle.properties file, you can add this property on the same line, as shown in the following example:org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=trueRestart Android Studio to apply the changes you made.Click Sync Project with Gradle Files to sync the project.Issues related to updating the IDE in Windows

On Windows, files cannot be deleted when used by a process. When you try to use the update mechanism built into the IDE, the IDE sometimes does not allow you to install the update, and you usually get an error message such as “Can’t delete C:\some\path\file”.

To work around this issue, open Task Manager and close processes that may be using the file; for example any gradle daemon.minSdkVersion-related issues

If you’re using an outdated version of Android Compatibility Libraries, you might receive an error message like the following::app:processDebugManifest app/src/main/AndroidManifest.xml:0:0 Error:uses-sdk:minSdkVersion 19 cannot be smaller than version L declared in library app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0-rc1/AndroidManifest.xmlSuggestion: use tools:overrideLibrary=”android.support.v7.appcompat” to force usage

To resolve this issue, use SDK Manager to update your system to the latest (non-preview) versions of these libraries. You can learn more about setting up compatibility libraries in Compatibility Library Settings. Android Emulator Issues

See How to troubleshoot Android Emulator.

Leave a Reply

Your email address will not be published. Required fields are marked *