Issue
I'm facing this kind of phantom error. I've tried many ways to resolve this problem but nothing works. I don't know what produces this issue. This is my error in Build Log :
e: /Users/galihlarasprakoso/Projects/Android/surat-kaleng/app/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/galihlprakoso/com/SuratKaleng/databinding/ActivityLoginBinding.java:17: error: cannot find symbol
protected ActivityLoginBinding(DataBindingComponent _bindingComponent, View _root,
^
symbol: class DataBindingComponent
location: class ActivityLoginBinding
e: /Users/galihlarasprakoso/Projects/Android/surat-kaleng/app/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/galihlprakoso/com/SuratKaleng/databinding/ActivityLoginBinding.java:31: error: cannot find symbol
@Nullable ViewGroup root, boolean attachToRoot, @Nullable DataBindingComponent component) {
^
symbol: class DataBindingComponent
location: class ActivityLoginBinding
e: /Users/galihlarasprakoso/Projects/Android/surat-kaleng/app/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/galihlprakoso/com/SuratKaleng/databinding/ActivityLoginBinding.java:42: error: cannot find symbol
@Nullable DataBindingComponent component) {
^
symbol: class DataBindingComponent
location: class ActivityLoginBinding
e: /Users/galihlarasprakoso/Projects/Android/surat-kaleng/app/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/galihlprakoso/com/SuratKaleng/databinding/ActivityLoginBinding.java:51: error: cannot find symbol
@Nullable DataBindingComponent component) {
^
symbol: class DataBindingComponent
location: class ActivityLoginBinding
e: [kapt] An exception occurred: java.lang.IllegalArgumentException: couldn't make a guess for galihlprakoso.com.SuratKaleng.databinding.ActivityLoginBindingImpl
This is my project level build.gradle.kts
file:
buildscript {
ext.kotlin_version = '1.2.71'
ext.dagger_version = '2.16'
ext.glide_version = '4.8.0'
ext.retrofit_version = '2.4.0'
ext.rxandroid_version = '2.1.0'
ext.rxjava_version = '2.2.2'
ext.support_version = '28.0.0'
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/drummer-aidan/maven/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my app level build.gradle.kts
file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "galihlprakoso.com.SuratKaleng"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
details.useVersion "$support_version"
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//noinspection GradleCompatible
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
//Dagger
implementation "com.google.dagger:dagger:$dagger_version"
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
kapt "com.google.dagger:dagger-compiler:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
//Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
//Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
//RXJava
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
//Material Dialog
implementation 'com.afollestad.material-dialogs:core:2.0.0-beta2'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.3'
//Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
configurations {
all*.exclude group: 'com.android.support', module: 'versionedparcelable'
}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
I don't know what's wrong, but when I try to access the variable that I've created in xml via binding.name_of_variable
, it says: cannot access class check, your module classpath for missing or conflicting dependencies
.
Solution
Try Invalidate Caches/Restart.. in Android Studio.
Select and click Files->Invalidate Caches/Restart..
.
This will regenerate the required ones.
Answered By - Sayooj
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.