The updated Android SDK and Android Studio messed up all my XML files: "XXX element is not allowed here"

I just updated my Android Studio and Android SDK, and now I can not do anything in my XML files. It shows the same as the previous one, but I can’t add anything, and something went bad.

Example:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/bocterAppLogo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/bocterapp" android:contentDescription=""/> </LinearLayout> 

This error says: "ImageView is not allowed here."

Do you have an idea why this happened?

Hurrah!

+5
source share
1 answer

I had the same problem. Try exchanging ImageView for android.support.v7.widget.AppCompatImageView! This solved it for me.

+3
source

Source: https://habr.com/ru/post/1208029/


All Articles