0

There are various types of problems occurring after updating Android Studio to 3.5.2 and it's plugins. Some of them are:

  1. Converted all XML codes to some unknown non-processable text format.
  2. Failing gradle syncs
  3. Android XML attributes like padding, layout_margin are shown as Unknown Attributes
  4. LinearLayouts are being deployed without throwing errors like Missing width or height
  5. ImageButton is not being able to process image automatically to given size.

Codes are included below from different files:

XML of a simple view

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".view.HomeActivity"
    android:padding="18dp"> <!-- Padding: No such attribute -->

    <TextView
        android:id="@+id/appTitleText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/app_name"
        android:textSize="28sp"
        android:textColor="@color/colorPrimaryDark"
        android:fontFamily="@font/comfortaa_variablefont_wght"
        android:textStyle="bold"
        android:layout_margin="8dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>
        <!-- Margin:  No such attribute -->

</androidx.constraintlayout.widget.ConstraintLayout>

XML of a deformed view

�PNG


IHDR   �   �   ��o�   tEXtSoftware Adobe ImageReadyq�e<  �IDATx��]}�$�w�2#+�$'�O����#w~$.��
�;0�M��6'x{E�?�O1�Q?b�0Y&�h���^��Vcrk�d
L��]�da�eR����uuUw����t��<^��ꞩ߾zU��jC��&I��C�C�?�YQK���Cm�h.|��/����    �D���~_�}�����A3�t��
��)����k~Y�|^d�as��q��I�ڧ�n�/�^�҅B�S�"=T�ڥ�^�eZ�Â�bЬO���o>�T�9߄So���7g��v����n��{��ۖ�)�JP�V%�j�����.��ˆ�>�;�W�c�?fЬ:�7H,�����`�I8��Ih6�P*Ah9�N�kM�G�P�B<p�#^lI˄u��ׂf�)�T���]u�9b���>��c��>�%�B�o���G���K�P*��|Q���Vk��B��Ҁ���9ӄ����~�o���W�~�w1h�C��"ˑ��@c��jEl   Ht=m'

�Ի��l��8�7�4`anAZ�C�9�J<���A���S��T���:
GqTv�RY��6�td����W ��!  �g���b���tZ�"=wfN�M��w���;�"����!�k���<t�C0y|Rv�B9h�P��
��� ��$���|�    ��y;|冯�GG����Z��Tb�)��H& �E|K!I5>@���64K������#�'� (�V��P�\���V�N� Yکǎ�J��5�j<7�,�~�Ҵ�
`H��g
u���raZ\/y�6���� Y]�z����ƈ�fY����nM�)겠m��L�%>+� �4kMNXF�%M�7vЕ9�.I�0 ��r�]Q�H>��5���oU"�j��o5�9����u�=�/�\�Z>�:��Xl�$i*{6��i�fK�g"�@`�$[L:I&�z�G(͖���ʼn6��MJ�r-҃N�c���]$MZ�iB�VI?�ݓ3�F��1�����j�]�N�_(x�X�\��Y�i3��0�i�P��   4���K�wCf7i�O��t�v���KQ��#x��4[������K��?E�����n�-h-���k)��@�;��z�ӽT�k�������ֶ�ؔkZ�h�JK|���Ru`�MQ��aO��[�f�����m��V��g~�A�u��!��u�ϼ�L���K+�A��'�JN7�+�/_P�B� 塲� �5ȺN�g��$�e��\(�zAT��Ȯ�nJ��z�E� �f%@c\R9��4<���0���\P].���5�k�_�7m��l�~��=�ZX8��RT����p��C0rud-���-h����O����{��T����0�%m ��� µ�,��m[��]���뿂�,�/�N����#?~Fo�7ľ��C3��Թ]s��&V*��W? ���t�ĔWϯ���r�{���7�
�H��=�9���l��|F�6
��������1�4W��Qp��A�xnj������LF/嘗���Y�4��?�P�Z9 ��  ��������T��#x2�����c{�w
Y_�?����A��_�vϠ�
E�U�w�&���������7{��B*Рs��.�a��Qh�א7�%���b��b��H��Z���+���,�Y0jC��'}'�of���c����ߓHdH�6����^��|���!x��
����;�l�x7v���A7��o}��u�=�M!Z�
��J��գ�`ϟ��mNFbW���:��J�T�{��NL�ʂ�V��'HZ����էי��.[�l��y���Y"�C����j�+7���g�#��'���]�O�FGI޿mHir��Wu����W6�\�{.�;�d>M�`[c�cۣ� ����`����7&'��K��U�����ϵQR�^�{ֳ��r��J�Ӵ���5��L��S��u�����8��c�Dɗ�   ���0�2&�ǕOʛdR��u&=���s��y%��1}?l{� bALj�4���* �w�^�e����g�鏜��ڐw�?�,�~��<1)�#���>볯w=།���W�٫4X 4�
�8����`�:k��A��충�   �됳���<Ng?m�d�o�F��ykFʤmĘ�C
��gC3�ۂv���a2�AA�Eep�BE�}I���I��P>�W��]�O�h���h�gO/Wv}  �!
��r���-�\�`}��ԀX��t�
�>.t�1�g[���$��އ..�gZ��ƱX���,�̞4m\��4}�� ��.,�%�Q�ѧQ�O�sûA�̏4�-QЬ�
�8��]�A{���k��Z���cFԶy&&��Nc��O�s�v��C-�9��P4����Q5~�J�Ԇ��Ϗ��
SK�DLݍR�h����D�JRC3.����    5���niB'���a7��?����n��g��iR��
�L�8�1)k���dy�5됛�)M���4�9�\~}�����X��9
��y��`�ׯӮ�b#ji\�l-�V�D8M\~���d��0B/Z�'�q��OF������:$�i)�a&����5�d��>;
XZN�e}��i,�~5��ב�7m�%6:��][�G�NG�UL��X`-�2��:�{�ICVxXf�]'� ���4I'��̦����u]�_a���ϕ^��4����)䴟�s5u��)iVxc�t1����0=��e��'i/u�ɪ��r��>I��
�̣�s�G_j;L���/����eS�D?`;��9�/��(��4����
Y�}��b0,;����L�vcGO�S��yZ[`nrWyj�X�m}(����o�'�S@�>��HH!1��di���Y�%K�s�i��J�[I�|�%]a?��l6�N^ �

Gradle file

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.oobs.juncos"
        minSdkVersion 22
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.0.0'

    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'
    implementation "androidx.core:core-ktx:+"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply plugin: 'com.google.gms.google-services'
repositories {
    mavenCentral()
}

I have tried rechecking my gradle and other files but no improvement.

Zun
  • 1,553
  • 3
  • 15
  • 26
Saswata
  • 1,290
  • 2
  • 14
  • 28
  • Hi @Saswata I am facing same issue after updating android studio.Sometimes all XML & Java file converted to some unknown non-processable text format. – Jahanvi Kariya Nov 08 '19 at 04:58
  • Yes you can find your `XML` when you open code with Notepad – Jahanvi Kariya Nov 08 '19 at 05:12
  • @JahanviKariya Hi but unfortunately we are facing various kinds of issues which changes time to time so looking for a permanent fix. – Saswata Nov 08 '19 at 05:17
  • @JahanviKariya Hi following your idea I have wrote a temporary solution below, please do add your observations and ways on edit if you feel so. – Saswata Nov 08 '19 at 05:29
  • Your **XML of a deformed view** is a png -picture ;-) – Simson Nov 08 '19 at 05:31
  • 1
    @Simson ok, but didn't see that coming... – Saswata Nov 08 '19 at 05:38
  • Not a duplicate, but we have e.g. this previous report about the "corrupt" files: [Android Studio shows wrong file contents](https://stackoverflow.com/questions/53249677/android-studio-shows-wrong-file-contents). – Markus Kauppinen Nov 08 '19 at 07:52

1 Answers1

0

A stable solution (For Linux users)

Uninstall the whole Android Studio and re-install without importing previous settings will fix the problem.

Saswata
  • 1,290
  • 2
  • 14
  • 28
  • Have you tried deleting the caches folder from Android Studio? maybe your old settings is not imported properly. – sanjeev Nov 08 '19 at 05:59