Following some links here I tried to rename a project. I went to c:\path\to\AndroidStudioProject and renamed the folder there, then found the .idea file and changed that. Now the project loads but java files are missing! However, on clicking java (in the bar at the top), then com I can see them each with a small red j.
I then looked in module Gradle build where there were 3 files, one with the new name and 2 older ones which stated that they did not belong so I deleted them, copying the compile info into the new one. Naturally on doing a Sync Now I get a bunch of errors.
Why does this have to be such a complex operation? Can anyone assist?
After you rename the folder, open the project in Android Studio. From there, right click something that needs to be renamed (e.g., module, package names, etc.) and use Refactor->Rename from the context menu. Keep doing this until everything that can be refactored is.
You will need to manually change the value of applicationId in the app-level build.gradle. Obviously, things like #string/app_name will also have to be changed manually. I recommend making these manual adjustments from inside Android Studio rather than directly editing the files. That way you'll know immediately if you break something.
I am working on a parser, using the parser generator ANTLR in Visual Studio. Naturally, ANTLR is continually regenerating certain files. Every single time it does this, VS has a popup saying:
The file has been modified outside of the source editor.
Do you want to reload it?
The answer I want is always Yes to All.
Is there any way to tell Visual Studioto always assume I want to reload auto-generated files, without prompting?
Click Tools then options then under the environment node on the left choose documents then check the box that says Auto-load changes, if saved:
If you are using Visual Studio's internal editor and you know that nobody else is editing the file, you might be wondering why that happens. In my case, I realized I was working on a continuously backed-up network folder, that's why the file got re-saved every time I made a change on it and saved. So, if you can move your file to a local, not-backed-up folder, that might also solve this problem.
Every once and a while I have an issue with the new Android Studio. Sometimes while editing, if I make a mistake in one of my files, then try to build it, Android studio will come back with some "Gradle" error. It will then automatically REVERT back to my original code (thus deleting any of my changes). I do not necessarily like this behavior, but I could deal with it.
However... sometimes, in the course of SAVING and editing, it gets into this weird state where Android Studio will REMEMBER the error, and wont let me correct it. I.e. it will keep restoring the OLD version of the file, with the error in it, no matter how many times I try to correct it and re-save it. An example of this is as follows. In the following XML document fragment, I mistakenly added the [android:backcolor="#00000000"] to one of my XML layout files...
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#111"
android:background="?android:attr/activatedBackgroundIndicator"
android:backcolor="#00000000"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
After trying to build, Android Studio came back with the following error:
"Error:(1, -1) Gradle:No resource identifier found for attributed 'backcolor' in package 'android'.
Of course, I tried to simply DELETE the offending line that I added to return my code to its original state, before I added the line. I saved it (i.e. save-all/etc...) then tried to rebuild. To my dismay, Android Studio RESTORES the bad version, reinserting the erroneous [android:backcolor="#00000000"] line again back into the file.
I have also tried SAVING (save all) exiting out, going back in, the rebuilding it again, and just about every variation of this. Though the ONLY way that seems that will correct it sometimes is to completely exit out of Android Studio, start it back up again, and try again.
I am guessing that this is really a "feature" and has something to do with source control, and/or Gradle, and that I just don't fully understand it yet. I am also guessing that there is some setting somewhere to adjust and/or correct this - but I am clueless as to what is going on and what to do to fix it.
Is there a way to correct this annoying behavior of Android Studio?
I've had a similar issue when I make a mistake in my strings.xml file, for example when I have an apostrophe without preceding with a '\'. The trouble is that when the build fails, Android Studio automatically opens app\build\intermediates\res\merged\debug\values\values.xml to show me the broken string. If I then try to correct the string in that file, it doesn't do any good because when I try to rebuild, strings.xml is still broken. The crucial thing is to make sure that you're making the correction in strings.xml rather than the values.xml file.
I have the same issue, but i followed following steps and it resolved my issue,
1) Edit your layout file and open the same layout file in notepad, if you can see updated data in notepad then its Studio Synch issue. then re-synch project.
2) If your edited layout file is not reflecting new changes in notepad file then, first re-synch Studio project and followed step 1.
I hope this will resolved your issue as well.
I still have this issue, the only way I have found to fix it is to go to the terminal in android studio and run
rm -R app/build/intermediates/data-binding-layout-out
Android Studio is failing to delete the last build of the layout, when you try to compile again. Once you do it manually everything is back to normal.
While this issue still occasionally happens (as of currently the latest version is 0.5.+), a simple workaround is to manually edit the xml file with a text editor, then save it. Android Studio will then force resync those files.
To save the latest edits, click on the particular file in project window and select synchronize, and rebuild the code. then the latest edits will be saved.
I just had the same error and made me go crazy
I solved it by copying my project file to another directory and then importing it as a new project and the problem disappeared
I have created an new UIMap in my project. I was able to work with it day before this error appeared. Now, when I right click on the new UIMap in VS (Visual Studio) and Click "Edit With Coded UI Test Builder" option - above error pops up.
I tried starting VS as admin, editing the .uitest file in the project folder (bad practice even if you know what you're doing) and saving it (it allowed me to do this), but still won't let me record using the new UIMap.
Additionally the original UIMap still works. I am using different names for UIMap if anyone is wondering.
I am using VS2012.
Any ideas would be appreciated. Thanks.
I have found the problem and A Solution for it, but not the cause. The properties of UIMaps .cs and .Designer.cs files were set to read-only. Please do let me know if anyone does find out what causes this and how to prevent this from occuring in the future.
My Solution:
Right click on the UIMaps .cs and .Designer.cs files in the project folder
Click on Properties
Untick Read-only tickbox
Voilà!
Thanks all.
Resharper really complains about files such as reference.cs that is generated by things like WCF service reference. How do I get Resharper to skip such files entirely?
menu ReSharper -> Options
Code inspection -> Settings item
button Edit items to skip
I got this to work by entering Referen?e.cs into the ReSharper Generated file masks list. Apparently the presence of the ? wildcard tricked it into applying to all Reference.cs files (well, remember that it will get files named Referente.cs too, but I can live with that.