This is the java file that is giving the error:
package com.example.daksh.timetable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button mon_but,tue_but,wed_but,thur_but,fri_but;
mon_but = (Button)findViewById(R.id.mon);
tue_but = (Button)findViewById(R.id.tue);
wed_but = (Button)findViewById(R.id.wed);
thur_but = (Button)findViewById(R.id.thur);
fri_but = (Button)findViewById(R.id.fri);
final ImageView main_Image = (ImageView) findViewById(R.id.day);
final int[] dayarray = {R.drawable.monday,R.drawable.tuesday,R.drawable.wednesday,R.drawable.thursday, R.drawable.friday};
mon_but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[0]);
}
});
tue_but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[1]);
}
});
wed_but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[2]);
}
});
thur_but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[3]);
}
});
fri_but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[4]);
}
});
}
}
The errors that I am getting:
Information:Gradle tasks [clean, :app:assembleDebug] C:\Projects\TimeTable\app\src\main\res\layout\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private. Error:resource android:attr/colorSwitchThumbNormal is private. C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private. Error:resource android:attr/colorSwitchThumbNormal is private. Error:failed linking file resources. Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ':app:processDebugResources'. Failed to execute aapt Information:BUILD FAILED in 9s Information:9 errors Information:0 warnings Information:See complete output in console
This is the Activity_main.xml file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".MainActivity">
<ImageView
android:id="@+id/day"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:contentDescription="TODO"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline_dayselection"
app:layout_constraintHorizontal_bias="0.519"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2"
app:layout_constraintVertical_bias="0.472"
app:srcCompat="@drawable/monday" />
<TextView
android:id="@+id/textView"
style="@style/Widget.AppCompat.TextView.SpinnerItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="serif"
android:text="@string/message"
android:textColor="?android:attr/colorSwitchThumbNormal"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/mon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="50dp"
android:text="@string/monday"
app:layout_constraintBottom_toTopOf="@+id/tue"
app:layout_constraintStart_toStartOf="@+id/guideline_dayselection"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/tue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="@string/tuesday"
app:layout_constraintBottom_toTopOf="@+id/wed"
app:layout_constraintStart_toStartOf="@+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="@id/mon" />
<Button
android:id="@+id/wed"
android:layout_width="88dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="@string/wednesday"
app:layout_constraintBottom_toTopOf="@+id/thur"
app:layout_constraintStart_toStartOf="@+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="@id/tue" />
<Button
android:id="@+id/thur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="@string/thursday"
app:layout_constraintBottom_toTopOf="@+id/fri"
app:layout_constraintStart_toStartOf="@+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="@id/wed" />
<Button
android:id="@+id/fri"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:text="@string/friday"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="@id/thur" />
<android.support.constraint.Guideline
android:id="@+id/guideline_dayselection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="196dp" />
<android.support.constraint.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15339233" />
</android.support.constraint.ConstraintLayout>
Can someone help me with this?