Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android xml files are showing java code suddenly. [duplicate]

I just changed base url in my build.gradle file debug section last night, since my base url was changed. It was all fine until today when i started my pc and android studio and saw that all of my xml files has java codes and all xml code has been erased/gone. I am really panicking. I dont know what exactly to do. Here is what is written in those xml files:

/* 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.google.android.gms.measurement.api;

public final class R {
    private R() {}

}

Each and every xml files has some new java code or something new written in them completely.

Also i would like to share that I have cloned this project from bitbucket which has old or other gradle version and i have newer one or latest one as of now (gradle version 4.6), but it was working the day i cloned it. Now i am not even able to build or rebuild properly, it always shows this error:

 Android resource compilation failed
    Output:  D:\Android projects\my_android\app\src\main\res\layout\activity_splash.xml:1: error: not well-formed (invalid token).

    Command: C:\Users\Datta\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\236d054aed32e77c579cff2f4ee8d067\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
            -o \
            D:\Android projects\my_android\app\build\intermediates\res\merged\debug \
            D:\Android projects\my_android\app\src\main\res\layout\activity_splash.xml
    Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #2

Please help me with this or suggest something.

like image 862
Cassius Avatar asked Sep 29 '18 12:09

Cassius


1 Answers

It seems like there is-are some issues in : res\layout\activity_splash.xml file which needs to check if declaration of widgets or etc have issues or not.

You can also use websites for checking the xml file for if it is valid or not like this one.

like image 124
ʍѳђઽ૯ท Avatar answered Oct 03 '22 01:10

ʍѳђઽ૯ท