Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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`
like image 380
DHANANJAY KUMAR Avatar asked Oct 27 '18 12:10

DHANANJAY KUMAR


People also ask

Does Android studio support XML?

Android Studio supports a variety of XML attributes in the tools namespace that enable design-time features (such as which layout to show in a fragment) or compile-time behaviors (such as which shrinking mode to apply to your XML resources).

Is XML deprecated Android?

Short answer: Not possible. @deprecated tags are used by the Android source inside comments as it can be seen in fw/base core/res/values/attrs. xml (see line 3427 for autoText as referred to in the original post), in fw/base core/res/values/public.

Why XML is used in Android not HTML?

HTML is a standard designed to display web pages. The android XML layout files are custom configuration files that are intended to be parsed by the dalvik VM.


2 Answers

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.

like image 168
masterQ Avatar answered Oct 21 '22 02:10

masterQ


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

C:\Users\user_Name\.AndroidStudio3.5\system\caches
like image 43
Innocent Avatar answered Oct 21 '22 02:10

Innocent