0

I was coding these past two weeks and it was compiling/running fine. Bear with me on the history as it might be relevant to the final issue.

One morning I start getting modules not found error and gradle warnings, out of nowhere.

I solve it then proceed to have a "Default activity not found". After I made sure I had a launcher activity in the manifest file, I figured I had a much bigger problem :

80% of my layout XML (in the /res folder) Are now containing chunks of my java code, in a completely random manner. The icing on the cake : when I rollback to previous commit, as old as 2 weeks ago (that where running 100% fine), they also have the "broken xml java layouts"

It's one of the weirdest things that happened to me for a long time, please share anything that might give a clue.

Sebastien FERRAND
  • 2,110
  • 2
  • 30
  • 62
  • 1
    It sounds like a source control problem rather than an Android problem. What are you using for source control? – LarsH Aug 19 '19 at 15:47
  • 1
    If you check out this project on a different computer (or even a different folder), does it still exhibit this? If you *look* at your (git? subversion?) history, does it still show this? – Martin Marconcini Aug 19 '19 at 15:47
  • @LarsH Bitbucket and source tree for navigation. You are right, I think I had issues with that before. – Sebastien FERRAND Aug 19 '19 at 15:53
  • @MartinMarconcini You also suspect the versioning. I will definitely try on another computer. As for the history, it weirdly has the same .xml erroneous files (when really it shouldn't. Also I'm sure I did not gitignore those files) – Sebastien FERRAND Aug 19 '19 at 15:53
  • When I check the project online, the xml layouts files are fine. I guess the problem is my sourcetree – Sebastien FERRAND Aug 19 '19 at 16:07
  • At least you didn't get something like mine https://stackoverflow.com/questions/56996857/android-studio-file-was-loaded-in-the-wrong-encodingutf-8-and-java-file-do – Vedprakash Wagh Aug 19 '19 at 16:11
  • 1
    Try a fresh `git clone` from the command line :) – Martin Marconcini Aug 19 '19 at 17:05
  • And sure enough, a clean clone of the project worked. I believe sourcetree and maybe android studio were at fault to some extend. Thank you all for your wise help. – Sebastien FERRAND Aug 21 '19 at 09:27

0 Answers0