I just built my first App on Android studio. Everything was fine until few days while making some changes I got a notification for update and went on with it only for me to start getting unresolved reference error.
Even with that the application would build and run well but the problem is every other project I created after that follow suit with the same error.
I have followed tried several advice but to no avail. I have deleted idea, imported the project from another one, done invalidate cache and restart, sync with system and sync with gradle.
I am currently trying to use Room on a new project and synchronized is marked unresolved reference as I tried to create singleton for my database.
I also noticed that my files are always corrupted, I have to go back to Git-hub to recopy those files even though they don't give error on compilation
In all I think these are the issues am facing both on current project and previous project
1. the unresolved reference 
Previous Project
        val sharedPref = activity!!.getPreferences(Context.MODE_PRIVATE)
        val none = resources.getString(R.string.none)
        val countries = arrayListOf<String>("Nigeria", "Zambia", "Ethiopia", "Ghana", none)
        val greenWallCountries = arrayListOf<String>("Great green")
        Collections.sort(countries, String.CASE_INSENSITIVE_ORDER)
        val adapter = ArrayAdapter(context!!, R.layout.spinner_item, countries)
        locationSpinner.adapter = adapter
        locationSpinner.isEnabled = false
        var chosen: String? = null
        greenwallVG.setOnClickListener {
            chosen = "ggw"
            greenwallVG.setBackgroundColor(R.color.primaryTransparent)
            countriesVG.setBackgroundColor(R.color.colorNeutral)
            locationSpinner.isEnabled = false
            Toast.makeText(context!!, "$chosen", Toast.LENGTH_LONG).show()
        }
Current Project
**synchronized is marked unresolve reference here
package com.example.contactmvvm
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import kotlinx.coroutines.internal.synchronized
@Database(entities = [ContactEntity::class], version = 1)
abstract class ContactDatabase : RoomDatabase() {
    abstract fun getContactDao():ContactDao
    companion object{
        private var instance:ContactDatabase?=null
        fun getInstance(context: Context) =
            instance?: synchronized(this){
                instance?: Room.databaseBuilder(context.applicationContext,
                ContactDatabase::class.java, "contact_database")
                    .fallbackToDestructiveMigration()
                    .build()
            }
    }
}
- error: Cannot find getter for field. private int id;
    package com.example.contactmvvm
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "contacts_table")
class ContactEntity(
    val firstName:String,
    val lastName:String,
    val sex: String,
    val address:String
    ) {
    @PrimaryKey(autoGenerate = true)
    private var id:Int = 0
}
Is there something else to be done to annul this error.
 
     
    