Hello I am trying to compile and run my Android Project and this error has occurred
Illegal char <:> at index 51: com.example.capstonecafe.app-mergeDebugResources-29:/values/values.xml
I have checked my values.xml which is below
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="http://schemas.android.com/tools"
xmlns:ns2="urn:oasis:names:tc:xliff:document:1.2">
<attr format="enum" name="animateCircleAngleTo">
<enum name="bestChoice" value="0"/>
<enum name="closest" value="1"/>
<enum name="clockwise" value="2"/>
<enum name="antiClockwise" value="3"/>
<enum name="constraint" value="4"/>
</attr>
I have 2 errors on this file which are
xmlns:ns1="http://schemas.android.com/tools"
xmlns:ns2="urn:oasis:names:tc:xliff:document:1.2"
If I remove one or the other many other errors occur on the file. I have tried putting this line of code in my gradle properties
android.enableJetifier=true
But my application closes right after the build is successful
Full Error Output
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing
com.android.build.gradle.internal.res.ResourceCompilerRunnable
> Resource compilation failed (Failed to compile values resource file
Cause: java.nio.file.InvalidPathException: Illegal char <:> at index
51: com.example.capstonecafe.app-mergeDebugResources-
29:/values/values.xml). Check logs for more details.
Activity.xml for the dependencies
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=".MainActivity"
android:background="@drawable/bg1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/cafeh"
android:layout_gravity="center"/>
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@ id/txtquote"
android:text="@string/quote"
android:layout_gravity="center"
android:textColor="#6E2C00"
android:textStyle="bold"
android:fontFamily="@font/carterone_regular"
android:textSize="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="2">
<info.hoang8f.widget.FButton
android:id="@ id/btnsignup"
app:buttonColor="@color/white"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Sign Up"
android:textColor="#6E2C00"
app:cornerRadius="4dp"
app:shadowColor="#6E2C00"
app:shadowEnabled="true"
app:shadowHeight="5dp" />
<info.hoang8f.widget.FButton
android:id="@ id/btnsignin"
app:buttonColor="@color/white"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Sign In"
android:textColor="#6E2C00"
app:cornerRadius="4dp"
app:shadowColor="#6E2C00"
app:shadowEnabled="true"
app:shadowHeight="5dp" />
</LinearLayout>
</RelativeLayout>
CodePudding user response:
I guess you have opened the values.xml file in the debug\values. These files are not supposed to be edited. As for your error, you can try either of the below
- First try Invalidate and restart cache then see if it works
- If still it does not work check all your xml files in the res directory to see where you have wrongfully entered an <:> character