This is the java file that is giving the error
package com.example.daksh.timetable;
import android.support.v7.app.AppCompatActivity;
import
I have this problem.The main problem was i added an attribute to an BottomAppBar
in the xml
file.I found error message in android bottom build section explained that error i replaced the attribute and every thing was ok. For others who have the same error but my solution not ok with them you have to read the error message it will guide you to the pain point.
This similar error may also show if you have deleted an Activity java file previously and have not deleted the corresponding xml layout file.
Delete the xml file for the deleted Activity java file and Clean or Rebuild the project.
The reason behind it may be because of the mismatch of context in the xml. (This might occur if you are copy-pasting an xml layout code) Match the tools:context to the java file of the activity.
-May be the problem is that you have deleted .java files doing this doesn't delete the .XML files so go to res-> layout and delete those .XML files that you had delete before. -the another problem may be you haven't delete the files that is present in manifests under syntax that you deleted recently... So delete and run the code
Error is associated with some issue with .xml file. Manually open each xml format file to check for error. I had same issue. Had to manually open each file. There was an error in @string call.
Look at the error you are getting:
C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private.
It means that in your activity_main.xml you are referencing the color "android:colorSwitchThumbNormal", but inside the 'android' namespace that resource is private. What you probably meant to do is try to reference that color from the support version of this attribute, so without the "android:" prefix.
<item name="android:colorSwitchThumbNormal">@color/myColor</item>
Replace with:
<item name="colorSwitchThumbNormal">@color/second</item>
Run ./gradlew build -stacktrace
in Android Studio terminal. It helps you to find a file that causes this error.