Beta 3 doesn't allow to rename resource files such as layout files. It does show the renaming dialog, but when trying to apply changes it reads the following error message:
Refactoring cannot be performed
File .../myapplication/R.java is read-only
Also I have Beta 2 version in a neighbor directory and renaming works perfect. Any ideas how to fix that?
UPD: I reported the bug (#65079508), and now it is marked as a duplicate of 65032914 https://issuetracker.google.com/issues/65032914
So, the issue is even wider and if I understand it well the bug will be fixed in some coming version of the Studio.
UPD#2: Beta 4 is released. The bug is still not fixed.
UPD#3 Fixed in Beta 5.
Click on the activity file from the project structure. Press "Shift + F6 ", you will be asked to rename the activity. Enter the new name and press Enter.
You can organize your resources XML files (layout, drawable,..) into separate subfolders corresponding to the app's features.
meh, just get rid of the generated files && then refactor.
Gradle --> app --> build --> clean.
I am experiencing the same issue on Android Studio 3.0 Beta 3. I fixed the problem by:
Obviously this forces you to have to manually refactor the references to the old file, but I tried about a dozen different things (changing R.java permissions, Gradle clean, invalidate cache, etc.) and none of them worked.
Anyone else who has this issue should submit this bug in Android Studio by using Help > Submit Feedback.
Also, is there a chance you might also be using multiple layouts folders like I am?
I've got the same issue. I was solved this with
File --> Invalidate Caches and Restart --> Invalidate and Restart.
And than try to rename again.
Hope this help. Happy coding :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With