Android Studio shows some mess in xml files

人走茶凉 提交于 2021-01-27 10:41:16

问题


While I was working with my android project I wanted to edit one of my xml files. So I just opened it and this is what I saw:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CMakeSettings">
    <configurations>
      <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
    </configurations>
  </component>
  <component name="PropertiesComponent">
    <property name="android.sdk.path" value="$USER_HOME$/AppData/Local/Android/Sdk" />
    <property name="settings.editor.selected.configurable" value="preferences.updates" />
  </component>
  <component name="RunManager">
    <configuration default="true" type="Application" factoryName="Application">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" />
      <option name="VM_PARAMETERS" />
      <option name="PROGRAM_PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="" />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JUnit" factoryName="JUnit">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <module name="" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="PACKAGE_NAME" />
      <option name="MAIN_CLASS_NAME" />
      <option name="METHOD_NAME" />
      <option name="TEST_OBJECT" value="class" />
      <option name="VM_PARAMETERS" value="-ea" />
      <option name="PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <option name="TEST_SEARCH_SCOPE">
        <value defaultName="singleModule" />
      </option>
      <envs />
      <patterns />
      <method />
    </configuration>
    <configuration default="true" type="Remote" factoryName="Remote">
      <option name="USE_SOCKET_TRANSPORT" value="true" />
      <option name="SERVER_MODE" value="false" />
      <option name="SHMEM_ADDRESS" value="javadebug" />
      <option name="HOST" value="localhost" />
      <option name="PORT" value="5005" />
      <method />
    </configuration>
    <configuration default="true" type="TestNG" factoryName="TestNG">
      <extension name="coverage" enabled="false" merge="false" sample_coverag

Then I found out another xml file that looks like this:

import android.os.AsyncTask;

import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.sheets.v4.model.BatchGetValuesResponse;
import com.google.api.services.sheets.v4.model.ValueRange;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class SheetsApiManager extends AsyncTask<Void, Void, List<List<String>>> {

    private com.google.api.services.sheets.v4.Sheets mService = null;
    private HttpTransport transport = AndroidHttp.newCompatibl

And this content is a cut Java class from another project that was opened in the same time. When I try to open this files in Notepad++ I can see the right code.

What I did so far was Clean Project, Rebuild Project, Invalidate Caches and Restart, Android Studio Restart, System restart and I deleted Build folder and rebuild project again. It still didn't bring any changes. I also thought about reinstalling Android Studio but I'd like to make it work again without this idea. Also running my app is not making any errors and it works fine.

Anyone had the same or similar issue?


回答1:


This happened even for the Android Studio v3.2.1 (latest stable version).

The only solution I have found was reinstalling the Android Studio without importing the old configuration.

Changing the File Encoding in settings to UTF-8 or System Default didn't help either.



来源:https://stackoverflow.com/questions/52821567/android-studio-shows-some-mess-in-xml-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!