Getting databinding error while adding activity via Android studio. How to resolve this error ?.
I am trying to add New Activity in my existing project via android studio. That time i used targetSdkVersion 30
sdk. But after updating targetSdkVersion 32
, While trying to add New Activity via android studio, getting this error as shown in picture.
This is my build.gradle
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
apply plugin: 'kotlin-android'
android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.softwares.bannari.whatstouch"
minSdkVersion 21
targetSdkVersion 32
versionCode 47
versionName "1.1.47"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
bundle {
language {
enableSplit = false
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
// implementation project(path: ':nativetemplates')
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.10'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation 'the.bot.box:appusagemonitor:2.1.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
// implementation project(path: ':nativetemplates')
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.github.natheeshsunway:Android-Permissions:2.0.5'
implementation 'com.google.android.material:material:1.6.0'
implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
implementation 'org.jetbrains:annotations:16.0.1'
implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.3.0'
implementation 'com.rm:rmswitch:1.2.2'
implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6"
implementation "com.airbnb.android:lottie:3.5.0"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.7.2'
implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.14.7'
implementation "androidx.preference:preference:1.2.0"
implementation 'com.google.android.gms:play-services-ads:19.7.0'
implementation 'com.suddenh4x.ratingdialog:awesome-app-rating:2.2.1'
implementation 'org.aviran.cookiebar2:cookiebar2:1.1.4'
implementation 'eu.dkaratzas:android-inapp-update:1.0.5'
implementation 'com.akexorcist:localization:1.2.6'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
def lifecycle_version = "2.0.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.4.1"
}
repositories {
mavenCentral()
}
CodePudding user response:
First delete the first line (imported library ) for ActivityGroupsActivityBinding, don't delete the Binding class and its object. Then click on the ActivityGroupsActivityBinding class name then you will got importing suggestion from left side. Or you can import again by clicking on it then pressing alt enter
See how to use Databinding in Android.