![]() Also the images added were having the extension with capital letters. Started when I added a few images in my drawable folder and tried to access them. You do this by going to the Build menu at the top and selecting Clean Project. Correct this by changing Gradle or downloading the appropriate build-tools.įinally, after you've fixed whatever is wrong, you need to clean your Gradle project. There are a few ways your Gradle file can end up referencing a version of the build-tools that you do not have installed. Xml files with reserved words for names can cause this problem. I don't know what was wrong, but it worked. In one case I moved my entire project to a different directory and re-imported it as a new project. In one case I had to completely reinstall Android Studio. If only some resources are having this problem, those resources are most likely in the wrong directory. For instance, you can have the same name in drawable-mhdpi and drawable-xhdpi because they override each other depending on the target device, but if you have the same name in layout and in menu, it will cause a problem. If you have two xml resources with the same name, in directories that do not override each other, you can have this problem. I don't know why, but sometimes it works. In my experience, sometimes Android Studio just hiccups for no reason, and you need to restart it and/or your PC. If you have a file in your resources that is corrupted, or an invalid xml file, you will get this error. Sometimes if anything references a nonexistent drawable or string resource you will get this error. If your AndroidManifest references a non-existent drawable or string resource or activity, it will break and cause this error. This is in the dependencies block in the outermost gradle file, As of today, 7/17/15, my apps are compiling fine with :gradle:1.2.3. It can sometimes be hard to find what the current versions are. Sometimes this is because it stops supporting older versions of the Gradle plugin, so you need to update your version numbers. Gradle files can be broken by upgrading Android Studio sometimes, especially from the pre-1.0 versions. If there are errors in either your Gradle files or your AndroidManifest.xml, this will prevent Android Studio from properly building your resource files. Also make sure that the package tag in your AndroidManifest.xml is correct. It's easier to fix this kind of problem from the one called Project, and even easier directly from your OS's file system, because Android Studio collapses folders that only contain another folder onto a single line.Įspecially if you ever change the name of your app, you need to make sure that the source tree main/java/com/domain/AppName is updated. There is a drop-down above the file tree that displays your files in different ways, and it defaults on my system to one called Android that breaks your files out into their different types. Values/ // All of your resource xml filesīadle // This is the gradle file you should be making most changes toīadle // This gradle file should mostly be left alone Longer packageĭrawable-*/ // One of these for each resolution you support You should normally leave it aloneĪndroidTest/ // Tests based on the Android instrumentation runner should go here gradle/ // This is a compiler created directory. It should look like this for a moderately mature app: AppName/ // AppName is your app's name, obviously Make sure you're using the correct directory tree. Importing from Eclipse to Android Studio does not always work smoothly, especially with older versions of Android Studio. Here's a list of all the problems I've had: ![]() It can be caused by a wide variety of issues that mostly all have to do with your project structure not matching what's expected. I have had this problem more times than I want to admit. This is a very old question, but it still happens a lot and there is no truly comprehensive answer here. (I am running a canary build so putting it down to that for now) UPDATE: I did have an issue after where Android Studio still showed the error after the fix, even though I could now build and run perfectly fine while the error was still there. My exact issue was caused because I was using flavour based manifest files and I copied some permissions inside the tag in the flavour by accident. The errors will open up the generated xml files from your build which will show any errors in red. In here you will get a list of anything that is causing issues in your resources and manifest file. Your inspection results will contain an element called 'Android'. When something is wrong, you can find out what it is by doing a code analysis run.Īnalyze -> Inspect code, scan the whole project using the 'Default' profile. I guessed I had an issue somewhere but wasn't sure where to look to find it (was it in the manifest, resource xml files etc?). I recently had this issue and the clean/build etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |