Android layout XML errors
up vote
-1
down vote
favorite
I am new to Android Studio and I am getting errors for the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:7: error: not well-formed (invalid token).
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #1
How can I fix these errors?
android
|
show 2 more comments
up vote
-1
down vote
favorite
I am new to Android Studio and I am getting errors for the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:7: error: not well-formed (invalid token).
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #1
How can I fix these errors?
android
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31
|
show 2 more comments
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am new to Android Studio and I am getting errors for the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:7: error: not well-formed (invalid token).
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #1
How can I fix these errors?
android
I am new to Android Studio and I am getting errors for the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:7: error: not well-formed (invalid token).
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #1
How can I fix these errors?
android
android
edited Nov 10 at 22:28
Marcin Orlowski
57k886119
57k886119
asked Nov 10 at 19:24
Cassandra Campbell
13
13
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31
|
show 2 more comments
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
2
down vote
At your xml file, at line 7 you are repeating "android" twice:
android:android:background="@color/graylight"
should be:
android:background="@color/graylight"
In addition in line 48:
You need to provide orientation to your LienarLayout view such as vertical or horizontal.
Also, last line needs to be removed:
</android.support.constraint.ConstraintLayout>
Your root view is LinearLayout.
Edit your xml as follow:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
In your last change your closing view didn't match the openning one.
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
|
show 11 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
At your xml file, at line 7 you are repeating "android" twice:
android:android:background="@color/graylight"
should be:
android:background="@color/graylight"
In addition in line 48:
You need to provide orientation to your LienarLayout view such as vertical or horizontal.
Also, last line needs to be removed:
</android.support.constraint.ConstraintLayout>
Your root view is LinearLayout.
Edit your xml as follow:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
In your last change your closing view didn't match the openning one.
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
|
show 11 more comments
up vote
2
down vote
At your xml file, at line 7 you are repeating "android" twice:
android:android:background="@color/graylight"
should be:
android:background="@color/graylight"
In addition in line 48:
You need to provide orientation to your LienarLayout view such as vertical or horizontal.
Also, last line needs to be removed:
</android.support.constraint.ConstraintLayout>
Your root view is LinearLayout.
Edit your xml as follow:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
In your last change your closing view didn't match the openning one.
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
|
show 11 more comments
up vote
2
down vote
up vote
2
down vote
At your xml file, at line 7 you are repeating "android" twice:
android:android:background="@color/graylight"
should be:
android:background="@color/graylight"
In addition in line 48:
You need to provide orientation to your LienarLayout view such as vertical or horizontal.
Also, last line needs to be removed:
</android.support.constraint.ConstraintLayout>
Your root view is LinearLayout.
Edit your xml as follow:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
In your last change your closing view didn't match the openning one.
At your xml file, at line 7 you are repeating "android" twice:
android:android:background="@color/graylight"
should be:
android:background="@color/graylight"
In addition in line 48:
You need to provide orientation to your LienarLayout view such as vertical or horizontal.
Also, last line needs to be removed:
</android.support.constraint.ConstraintLayout>
Your root view is LinearLayout.
Edit your xml as follow:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/graylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="260dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/gradientbackground"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="425dp"
android:scaleType="centerInside"
android:src="@drawable/jus" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Justina Simone"
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_person_add_black_24dp" />
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_message_black_24dp"/>
<ImageView
android:layout_width="425dp"
android:layout_height="85dp"
android:src="@drawable/ic_grade_black_24dp"/>
</LinearLayout>
In your last change your closing view didn't match the openning one.
edited Nov 10 at 22:37
answered Nov 10 at 21:59
HaroldSer
1,2762615
1,2762615
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
|
show 11 more comments
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
Thanks for catching that. I just fixed that.
– Cassandra Campbell
Nov 10 at 22:21
You're welcome :)
– HaroldSer
Nov 10 at 22:22
You're welcome :)
– HaroldSer
Nov 10 at 22:22
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Android resource compilation failed Output: /Users/cassandracampbell/AndroidStudioProjects/Profile/app/src/main/res/layout/activity_profile.xml:48: error: mismatched tag.
– Cassandra Campbell
Nov 10 at 22:24
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Command: /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/554c09d4342abb7d275bb8bd5da525f8/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy -o /Users/cassandracampbell/AndroidStudioProjects/Profile/app/build/intermediates/res/merged/debug
– Cassandra Campbell
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
Your LinearLayout needs an orientation. See my updated response.
– HaroldSer
Nov 10 at 22:25
|
show 11 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242618%2fandroid-layout-xml-errors%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The error message says there is an error in "app/src/main/res/layout/activity_profile.xml" so please share this layout file (and since there seems to be an "invalid token" somewhere please make sure the snippet here is as exact a copy of your xml file as possible)
– 0X0nosugar
Nov 10 at 19:45
@0X0nosugar How can I upload the layout file?
– Cassandra Campbell
Nov 10 at 21:13
You can edit your own question (click on "edit" below the android tag). Then you can copy-paste the xml into the text area and format it as code. There is a small question mark in the top right corner of the text area if you need help with the markdown
– 0X0nosugar
Nov 10 at 21:19
@0X0nosugar It is not letting me indent the code. When I try to do so, it just keeps saying to re-paste the code I've already entered
– Cassandra Campbell
Nov 10 at 21:30
Then just paste the code into the text area and I'll try to edit it.
– 0X0nosugar
Nov 10 at 21:31