DHANANJAY KUMAR
DHANANJAY KUMAR

Reputation: 86

Android studio not able to show xml files correctly

Android studio suddenly showing autogenerated codes in xml files. I have tried invalidate cache/restart, but it doesn't solve the problem. I had also tried clean project and rebuild it but it also doesn't work. Even though everything shows correctly in a editor like sublime text. Here is my code of one of the xml files that android studio showing.

Code as showing in android studio

Code as shown in sublime text editor

`/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */

package com.airbnb.lottie;

public final class R {
    private R() {}

    public static final class anim {
        private anim() {}

        public static final int abc_fade_in = 0x7f010000;
        public static final int abc_fade_out = 0x7f010001;
        public static final int abc_grow_fade_in_from_bottom = 0x7f010002;
        public static final int abc_popup_enter = 0x7f010003;
        public static final int abc_popup_exit = 0x7f010004;
        public static final int abc_shrink_fade_out_from_bottom = 0x7f010005;
        public static final int abc_slide_in_bottom = 0x7f010006;
        public static final int abc_slide_in_top = 0x7f010007;
        public static final int abc_slide_out_bottom = 0x7f010008;
        public static final int abc_slide_out_top = 0x7f010009;
    }
    public static final class attr {
        private attr() {}

        public static final int actionBarDivider = 0x7f030000;
        public static final int actionBarItemBackground = 0x7f030001;
        public static final int actionBarPopupTheme = 0x7f030002;
        public static final int actionBarSize = 0x7f030003;
        public static final int actionBarSplitStyle = 0x7f030004;
        public static final int actionBarStyle = 0x7f030005;
        public static final int actionBarTabBarStyle = 0x7f030006;
        public static final int actionBarTabStyle = 0x7f030007;
        public static final int actionBarTabTextStyle = 0x7f030008;
        public static final int actionBarTheme = 0x7f030009;
        public static final int actionBarWidgetTheme = 0x7f03000a;
        public static final int actionButtonStyle = 0x7f03000b;
        public static final int actionDropDownStyle = 0x7f03000c;
        public static final int actionLayout = 0x7f03000d;
        public static final int actionMenuTextAppearance = 0x7f03000e;
        public static final int actionMenuTextColor = 0x7f03000f;
        public static final int actionModeBackground = 0x7f030010;
        public static final int actionModeCloseButtonStyle = 0x7f030011;
        public static final int actionModeCloseDrawable = 0x7f030012;
        public static final int actionModeCopyDrawable = 0x7f030013;
        public static final int actionModeCutDrawable = 0x7f030014;
        public static final int actionModeFindDrawable = 0x7f030015;
        public static final int actionModePasteDrawable = 0x7f030016;
        public static final int actionModePopupWindowStyle = 0x7f030017;
        public static final int actionModeSelectAllDrawable = 0x7f030018;
        public static final int actionModeShareDrawable = 0x7f030019;
        public static final int actionModeSplitBackground = 0x7f03001a;
        public static final int actionModeStyle = 0x7f03001b;
        public static final int actionModeWebSearchDrawable = 0x7f03001c;
        public static final int actionOverflowButtonStyle = 0x7f03001d;
        public static final int actionOverflowMenuStyle = 0x7f03001e;
        public static final int actionProviderClass = 0x7f03001f;
        public static final int actionViewClass = 0x7f030020;
        public static final int activityChooserViewStyle = 0x7f030021;
        public static final int alertDialogButtonGroupStyle = 0x7f030025;
        public static final int alertDialogCenterButtons = 0x7f030026;
        public static final int a`

Upvotes: 8

Views: 5108

Answers (6)

eva
eva

Reputation: 49

It happens sometimes when an android studio working a long time. Reopen the project may help you.

Upvotes: 0

Abhign01
Abhign01

Reputation: 311

Here's what worked for me. First Close Android Studio.

and Go to

C:\Users\your_user_name\ .AndroidStudio3.5\system\caches

Delete the caches folder.

And open the android studio. And your project is now open without any problem.

Upvotes: 1

Innocent
Innocent

Reputation: 733

If you didn't clear the cache of android studio, then try to clear it.

C:\Users\user_Name\.AndroidStudio3.5\system\caches

Upvotes: 1

masterQ
masterQ

Reputation: 51

Just copy the existing project to another folder and reopen the project with android studio, it will display normally again.

This problem happen to me today, when I opened a java file android studio showed me the XML file.

Upvotes: 5

Ashenn
Ashenn

Reputation: 11

This happened with me once , i closed android studio and everything else that opened the same project folder (IDE , git GUI) then opened it again, xml files showed as they were supposed to.

Hope this helps.

Upvotes: 0

navylover
navylover

Reputation: 13539

There should be errors in your layout xml files or AndroidManifest.xml file. I noticed only some files have red under wavy line, check them carefully, especially which includes custom widgets like lotteryanimationview.

Upvotes: 0

Related Questions