Editing using Android Studio

In VS2013 when I click project popup menu to edit user interface files in Android Studio I can see Android Studio open and I can edit UI files and save them but when I rebuild the project in VS2013 I get following error

Error 1 (Android) Resource entry main is already defined.
res\layout\main.layout-xml:0: Originally defined here.
res\layout\main.xml___jb_old___ 0 1

That might be project specific, how does your project structure look like, or is this a plain new project?

It is plain new project.

That looks like a bug with that __jb_old__ file; Can you delete that one? I’ll look into fixing the code to not include that when copying.

Thanks, logged as bugs://72229

bugs://72229 got closed with status fixed.

I’m getting this problem now with Visual Studio 2015 Update 3 and Android Studio 2.2.3 on Windows 7, using Elements 9.0 (and also with 8.4).

After modifying res\layout\main.xml and res\values\strings.xml, Android Studio generates two files with the same name and extension ended in ___ jb _ tmp ___.

I can see main.xml___jb_tmp___ and strings.xml___jb_tmp___ from within Android Studio, but they are not shown in Visual Studio. They are hiddenly copied to the proyect, and they are the cause of errors like: “(Android) Resource entry xxx is already defined” and “(Android) Originally defined here”.

May be it’s a regression?

I’ve found a possible workaround: Tell Android Studio to not generate this temporary files.

To do this: Click on “File Menu” --> “Settings”. Go to “Appearance & Behaviour” --> “System Settings”, and uncheck “Use safe write (save changes to a temporary file first)”

I hope this helps…

can you give us concrete steps to reproduce this?

I’m doing nothing special. The simplest example is:

  1. Open Visual Studio 2015
  2. File -> New project. I select the template “Android Application” from Templates -> RemObjects Silver -> Java -> Android. Press OK.
  3. Click on project name (the default one: org.me.androidapplication1) in “Solution Explorer” and press “Edit User Interface Files in Android Studio”
  4. In Android Studio I add a TextView in the main.xml designer, save all and close program.
  5. Back in Visual Studio I see that everything is OK.
  6. Press again “Edit User Interface Files in Android Studio”
  7. Add another widget (Plain text, for example), and press save button again… and inmmediatly “appears” the file “main.xml___jb_tmp___”…