2

I'm working on Android Studio 3.2.1 and Kotlin plugin 1.3.10. Suddenly, I face this problem in all .kt files or in Layouts. Also the Manifest is showing something like rubbish code. Please check the attached photos.

What happened? How I can fix this problem?

AndroidManifest.xml showing garbled file with a PNG header

XML Layout file

I thinks something wrong happened to my Android Studio because I test another project and the same problem appears

photo from another project

engmms
  • 347
  • 1
  • 4
  • 16
  • 1
    It looks like you overwrote your `AndroidManifest.xml` file with a .png file of the same name. Are you able to restore it from version control? – Michael Dodd Dec 20 '18 at 15:56
  • Michael Dodd..Already I have backup when I restore backup ..the problem still appear – engmms Dec 20 '18 at 16:04
  • I'd guess there's also problem with your backup then. Is it only your `AndroidManifest.xml` file affected? I also see the `selector` element in what should be a layout file, I'm guessing that's ended up being overwritten from `res/drawable`? – Michael Dodd Dec 20 '18 at 16:05
  • Either way I'd seriously recommend looking into version control tools such as Git to avoid problems like this in the future. – Michael Dodd Dec 20 '18 at 16:07
  • Michael Dodd..in third photo there logo appear like wifi in the top of layout – engmms Dec 20 '18 at 16:24
  • There has been questions about "corrupted" files in Android Studio lately and seems like the files are okay on the disk, but there's a problem in Android Studio. There's for example [this one](https://stackoverflow.com/questions/53557902/android-studio-3-2-1-keeps-corrupting-java-files-on-weird-xml) and plenty more. – Markus Kauppinen Dec 20 '18 at 16:32
  • Markus Kauppinen..this is helpful but now I return back to old version Or updated to 3.3 RC(Beta)??? – engmms Dec 20 '18 at 17:09
  • I haven't experienced the problem myself and am using "stable channel" versions myself. I'd look at the older questions and answers for hints on how to proceed. [This one](https://stackoverflow.com/questions/53098150/java-and-xml-files-corrupted-by-weird-xml-in-android-studio3-2-1) mentions a solution, but there may be better ones. – Markus Kauppinen Dec 21 '18 at 08:17
  • I return to old version 3.1.4 ..it is Ok ..thanks Markus Kauppinen – engmms Dec 21 '18 at 19:20
  • Does this answer your question? [Android Studio shows wrong file contents](https://stackoverflow.com/questions/53249677/android-studio-shows-wrong-file-contents) – Ryan M Feb 26 '20 at 08:16
  • Solution for latest android studio https://stackoverflow.com/a/68746941/5773037 – Nikunj Paradva Aug 11 '21 at 18:14

2 Answers2

0

You just inflated a binary file into your text file AndroidManifest.xml. As @MichaelDodd pointed out: it seems to have been a PNG. Maybe you messed up a drag-n-drop or something.

Try to restore your AndroidManifest.xml.

shkschneider
  • 17,833
  • 13
  • 59
  • 112
0

I know ,,this is late answer,but in fact the problem here you can fix it by more than way::

  1. update android studio Version
  2. return to older version
  3. clear cache for your project then restart
engmms
  • 347
  • 1
  • 4
  • 16