After changing developing OS, it shows "Unresolved reference: synthetic"



I am developing an Android app and I am new to it. I used to develope this app on Windows 10 Pro and everything works fine, no error. Recently, I have erased my Windows 10 and use Manjaro Linux (KDE version). When I pull my code from GitHub and open in Android Studio, the line: import* shows have the error: Unresolved reference: synthetic

my imports

package com.marco.booking_app.auth

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.TextView
import com.marco.booking_app.MainActivity
import com.marco.booking_app.R
import com.marco.booking_app.extensions.Extensions.toastError
import com.marco.booking_app.utils.FirebaseUtils.firebaseAuth
import* // It shows "Unresolved reference: synthetic"

build.gradle (Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.5.10"
    repositories {
    dependencies {
        classpath ""
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath ''

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

allprojects {
    repositories {
        jcenter() // Warning: this repository is going to shut down soon

task clean(type: Delete) {
    delete rootProject.buildDir

build.gradle (App)

plugins {
    id ''
    id 'kotlin-android'
    id 'kotlin-android-extensions'

apply plugin: ''

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.marco.booking_app"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    kotlinOptions {
        jvmTarget = '1.8'
    buildFeatures {
        viewBinding true

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.5.0'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation ''
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
    implementation 'androidx.annotation:annotation:1.2.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation platform('')
    implementation ''
    implementation ''


  1. What makes this error occur?
  2. How can I solve it?


You need to build your code at least once for the build-time generated synthetic code to be available. Just importing the project does not build it.

Note that synthetic view binding with kotlin-android-extensions is deprecated. You can use e.g. view binding instead.

Answered By – laalto

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published