-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Troubleshooting Common Issues
This page will compile common issues experienced with Android Studio 1.0 or above as they are experienced and recorded.
If you want to do more in-depth debugging in your code, you can setup breakpoints in your code by clicking on the left side pane and then clicking on Run
->Debug
. You can also click on the bug icon if you've enabled the Toolbar (View
->Enable Toolbar
):
Android Studio contains a panel to receive logging messages from the emulator, known as LogCat. If you are not seeing any log messages, click on the Restart icon .
If you are having issues trying to connect to the emulator or see any type of "Connection refused" errors, you may need to reset the Android Debug Bridge. You can go to Tools
->Android
->Android Device Monitor
. Click on the mobile device icon and click on the arrow facing down to find the Reset adb
option.
If you decide to rename any of your ID tags in your XML files, you may get "No resource found that matches given name." You will need to do a Rebuild Project
so that the entire resource files can be regenerated and the build/ directories are fully removed. Note: Clean Project
may not work.
If you see org.gradle.tooling.GradleConnectionException
errors, you may need to install a newer version of JDK (there have been reports of 1.7.0_71 having this issue). First try to restart the adb server first.
If you're opening another Android Studio project and the project fails to compile, you may see "failed to find Build Tools revision x.x.x" at the bottom of the screen. Since this package is constantly being changed, it should be no surprise that other people who have installed Android Studio may have different versions. You can either click the link below to install this specific Build Tools version, or you can modify the build.gradle file to match the version you currently have installed.
One of the issues in the new Gradle build system is that you can often get "Multiple dex files define" issues.
If a library is included twice as a dependency you will encounter this issue. Review the libs
folder for JARS and the gradle file at app/build.gradle
and see if you can identify the library dependency that has been loaded into your application twice.
If one dependency library already includes an identical set of libraries, then you may have to make changes to your Gradle configurations to avoid this conflict. For instance, including the Butterknife library with the Parceler library causes multiple declarations of javax.annotation.processing.Processor. In this case, you have to exclude this conflict:
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor' // butterknife
}
Another error if you attempt to include a library that is a subset of another library. For instance, suppose we included the Google play-services library but thought we also needed to include it with the play-services-map library.:
dependencies {
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.android.gms:play-services-maps:6.5.+'
}
It turns out that having both is redundant and will cause errors. It is necessary in this case to remove one or the other, depending on your need to use other Google API libraries.
For common issues experienced with Eclipse, check the Troubleshooting Eclipse Issues page instead for a detailed list of common problems.
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.