Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Attribute not allowed here. #448

Open
Dujana-Abrar opened this issue Apr 15, 2019 · 11 comments
Open

Error: Attribute not allowed here. #448

Dujana-Abrar opened this issue Apr 15, 2019 · 11 comments

Comments

@Dujana-Abrar
Copy link

activity_main.xml is giving an error when setting the height and width of the layout:- Attribute android:layout_width and android:layout_height is not allowed here. And it is also showing in setting the TextView :- Element TextView is not allowed here.

Here is the code in activity_main.xml.

<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!--TODO (1) Change the ConstraintLayout to a FrameLayout.
    Note that you don't need to use the fully qualified name for FrameLayout. Replace
    "android.support.constraint.ConstraintLayout" with "FrameLayout"-->
<!--TODO (6) Remove the line that declares the id, we don't need it-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--TODO (2) Remove all attributes with the word constraint in them-->
    <!--TODO (3) Remove the default text-->
    <!--TODO (4) Give the TextView 16dp of padding-->
    <!--TODO (5) Set the text size to 20sp-->
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="16dp"
        android:textSize="20sp" />
</FrameLayout>
@Joemw07
Copy link

Joemw07 commented Oct 3, 2019

still having the same problem

@JuHyun419
Copy link

Did you solve the problem?

@robpepper
Copy link

How could install a brand new android studio, it's not working?!

@eitanrab
Copy link

eitanrab commented Apr 18, 2020 via email

@Bhautik2902
Copy link

I also have the same issue but couldn't find any solution till now.
What I have tried is.

  • close and reopen manifest file and activity_main.xml as it is suggested in stackoverflow.
  • change sdk version and re-sync project.

@kunal170
Copy link

The same Problem I was Facing but I use the following trick that worked for me.

Go to File Section then click on Invalidate Caches/Restart

I hope After doing this issue should be solved.

@Bhautik2902
Copy link

@kunal170 I have tried this but the issue remains. :(
please suggest any other approach.

@kunal170
Copy link

@kunal170 I have tried this but the issue remains. :(
please suggest any other approach.

@gOgRABgEEK so I think the last option remains is copy the content of your project to somewhere else and delete the existing project and create new one and paste the content.
For my some project making on Android Studio there is some problemn with emulator but I follow the above thing and suprisingly it worked for me though I still don't know what the actual problemn was but currently it is working perfectly.

@royal-sheikh-04
Copy link

116802023-47b93780-ab31-11eb-9586-1c1c5cc6940d
I have same issue please Solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants