Tools and libraries that require the app’s class files not compatible with Jack
Various tools that read .class files (such as JaCoCo, Mockito, and some lint checks) are currently not compatible with the Jack compiler.
Gradle build unable to clean output folders when project is on NTFS on Linux
Due to the file locking behavior of NTFS, on Windows the IDE will automatically copy the classes jars to another location before indexing, so that subsequent Gradle builds can clean and make changes to the build/ tree. This behavior is
not automatically enabled when using NTFS on Linux or OS X, as reported in
issue 202297, but can be manually specified in idea.properties:
#---------------------------------------------------------------------
# IDEA can copy library .jar files to prevent their locking.
# By default this behavior is enabled on Windows and disabled on other platforms.
# Uncomment this property to override.
#---------------------------------------------------------------------
idea.jars.nocopy=false
Mac OS X Performance
The OpenJDK 1.8.0_76 bundled with Studio 2.2 has a few problems on Mac. U
sing an external 4K monitor with a scaled resolution can adversely impact rendering performance as discussed in issue 203412 and in IDEA-144261, up to the point the IDE becomes unresponsive
. Additionally, as reported in issue 223749 and in IDEA-158500, scrolling is very sensitive on OS X 10.12 (Sierra).
Gradle Sync Failed: Broken Pipe
The issue is that the Gradle daemon is trying to use IPv4 instead of IPv6.
Workaround 1: On Linux, put the following in your ~/.profile or ~/.bash_profile: export _JAVA_OPTIONS="-Djava.net.preferIPv6Addresses=true"
Workaround 2: in Android Studio's
vmoptions file, change the line
-Djava.net.preferIPv6Addresses=true to -Djava.net.preferIPv6Addresses=true
More details:
Networking IPv6 User Guide
"peer not authenticated" errors from Gradle sync or SDK Manager
The root cause is a missing certificate in $JAVA_HOME/jre/lib/certificates/cacerts
.
- If you're behind a proxy, try to connect directly. If the direct connection works, then in order to connect via the proxy you may need to use
keytool
to add the proxy server's certificate to the cacerts
file.
- Re-install a supported, unmodified JDK. There's a known issue affecting Ubuntu users which results in an empty
/etc/ssl/
certs/java/
cacerts
, and the workaround is:
$ sudo /var/lib/
dpkg/info/
ca-certificates
-java.postinst configure
Spurious Render Exception
The specific render error message is:
The following classes could not be found:
- android.support.v7.internal.app.WindowDecorActionBar
Despite the error message, the layout preview is correct and the message can be safely ignored. The issue has already been fixed in 2.0 preview. See bug
192102 for more details.
Can't Render Layouts in Android Studio 1.2
The specific render error message is:
The following classes could not be instantiated:
- android.support.v7.internal.widget.ActionBarOverlayLayout
This is bug
170841 which will be fixed in version 1.2.3 of the Android Gradle plugin.
Workaround 1: First manually build the project, then manually sync the project (using the Sync with Gradle files in the toolbar, or from the Tools > Android menu), then finally press Refresh in the toolbar above the layout editor.
Workaround 2: Switch the Android Gradle plugin from 1.2.x to 1.1.3 for now. When 1.2.3 is released you can switch back to the 1.2.x versions.
Workaround 3: Try updating to Android Studio 1.3 Canary. Please report back on the
issue tracker whether it worked for you or not.
Frozen Keyboard Input: "iBus" Problems on Linux
"Update & Restart" Doesn't Restart
In Android Studio 1.2 Preview 1 & 2, selecting "Update & Restart" to update from one version to the next, does not actually restart. Just manually exit the IDE, and start it again. Once you do that, the patch will be installed and the IDE updated.
Can't Run SDK Manager (Broken find_java.bat)
There was a bug in the find_java.bat command that shipped with SDK Tools 24.0.0. This was fixed in version 24.0.1, but unfortunately, that command is used on some systems to launch the SDK Manager itself.
If you are unable to launch the SDK Manager to update, you can
download find_java.zip from this page, and unzip it into the root of your Android SDK installation; it will replace the files
tools\lib\find_java.bat
,
tools\lib\find_java32.exe
and
tools\lib\find_java64.exe
with the versions from 24.0.1.
(If you are using Android Studio 1.0.1, the IDE will prompt you to update to tools 24.0.1 which it will do inside the IDE, so that update should work without needing to call find_java
; similarly, if you are using ADT, you should be able to open the SDK Manager from within the IDE, which should work without find_java
).
Gradle DSL method not found: 'runProguard()'
If you are updating from Android Studio 0.8.x to Android Studio 1.0.0-RC, y
ou'll need to update your Gradle plugin version from 0.13.x to 1.0.0-rc4. There were a couple of last minute API changes; for example, change "runProguard" to "minifyEnabled", etc. See the release notes under http://tools.android.com/tech-docs/new-build-system for more details on the changes if you run into build/Gradle sync issues.
Other Difficulties Loading Older Gradle Projects
"minSdkVersion 19 cannot be smaller than version L"
If your build fails with an error message like this:
: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.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
you are using an obsolete version of the Android support libraries. Open up the SDK manager and update to the latest (non-preview) versions.
"Android SDK folder inside the application folder"
When updating to version 0.8.13 or newer, the patch installation may detect the Android SDK folder inside your application folder. If this occurs, you must move your sdk folder outside of the application folder for the update to take place. Once Android Studio is updated, on its first run it will ask you for the location of the sdk. Projects that were referencing the old sdk location will be automatically updated once opened in Android Studio. We do not recommend moving the sdk directory back into Android Studio as this would interfere with the application signature, particularly on MacOS, and would prevent future updates to do verifications and avoid corrupted installations.
More information in issue 78129.
To move the SDK folder in Windows or Linux, simply go to Android Studio's folder and drag the "sdk" folder to another location, such us your user directory or alongside Android Studio's folder. On MacOS go with Finder to the application folder called "Android Studio.app", right click on it and select "Show Package Contents". When its contents are shown you can now drag the "sdk" folder to its new location.
JUnit tests missing resources in classpath when run from Studio
Issue: If you have specific resource folders in your Java modules, then those resources won't be found when running tests from the IDE. Running tests using Gradle from the command line will work. Executing the gradle check task from the IDE will also work. See
Issue 64887 for more details.
This issue happens because as of IntelliJ 13, you can only have a single folder as the classpath. IntelliJ's builder copies all resources into that build folder. But Gradle doesn't copy over the resources.
You can use any of the following workarounds until then:
- Run the gradle check task from the IDE rather than running a unit test
- Or update your build script to manually copy resources into the build folder. See
comment #13.
Running JUnit tests compiles the code twice
When creating a new project, the template JUnit configuration may be created with two "Before launch" steps: Make and Gradle-aware Make. This is then propagated to all created JUnit run configurations. To fix the issue, go to Run -> Edit Configurations and change the default JUnit configuration to only include the Gradle-aware Make step. To fix this for all future projects, close the current project (File -> Close Project) to get to the welcome screen, select Configure -> Project Defaults -> Run Configurations and make the same change.
Some test run configurations don't work
Not all run configurations that are available when right-clicking a test method are valid. Specifically:
- Gradle run configurations (ones with Gradle logo as the icon) don't work.
- JUnit run configurations (icon without a green android) don't apply to instrumentation tests, which can't be run on the local JVM.
Additional problem is that Android Studio remembers the run configuration created in a given context (e.g. right-clicking a given class/method) and will not offer to run a different one in the future. To fix this, go to Run > Edit Configurations and remove the incorrectly created configurations.
Linux and the Awesome WM
In Android Studio 0.8.3+:
Studio 0.8.3 does not work properly on Linux with the "Awesome WM" window manager version 3.4. It's supposed to work with 3.5.
Ubuntu and JAyatana
JAyatana allows Java Swing applications to integrate with the global menu in Ubuntu's Unity graphical shell. We have
reports of Studio running into a NullPointerException under Unity:
java.lang.NullPointerException
at com.jarego.jayatana.swing.SwingGlobalMenu.getSwingGlobalMenuWindowController(SwingGlobalMenu.java:204)
at com.jarego.jayatana.swing.SwingGlobalMenu.installLockParentGlobalMenu(SwingGlobalMenu.java:160)
at ...
- unset the JAVA_TOOL_OPTIONS environment variable when running Studio;
- uninstall JAyatana.
Can't Update to Latest Version
On Windows, files that are in use by a process cannot be deleted.
When you attempt to use the builtin update mechanism in the IDE, it sometimes refuses to install the update, usually providing an error message like "Can't delete C:\some\path\file".
To work around this, open the task manager and attempt to kill processes that may be using the file, such as any gradle daemons.
Google Play Services 5.0.77
If your builds suddenly stop working with this error message:
Error: Failed to find: com.google.android.gms:play-services:5.0.77
this is caused by the play services artifact being removed from the local Google Maven repository because it contained some critical bugs. It was been replaced by version 5.0.89 instead. (
More information)
Google Play Services "5.2.8"
A new version of the Google Play Services library was released recently: 5.2.08. If you are using an older version of the library, Android Studio will automatically offer to upgrade it to the new version. However, due to a bug, it drops the leading zero in "08", which means it replaces the dependency with "5.2.8" instead of "5.2.08" which does not work. To fix this, edit the dependency to read "5.2.08" instead of "5.2.8". (
More information).