Android project build error Duplicate of android class.data binding.Database observed in data binding modules-runtime-7.0.4-runtime

1k views Asked by At

When building a project in Android Studio, Duplicate of android class.data binding.Database observed in data binding modules-runtime-7.0.4-runtime, an error appears below is an incomplete error code and gradle files of the project:

Duplicate class androidx.databinding.BaseObservableField found in modules databinding-runtime-7.0.4-runtime (androidx.databinding:databinding-runtime:7.0.4) and jetified-library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11) Duplicate class androidx.databinding.BaseObservableField$DependencyCallback found in modules databinding-runtime-7.0.4-runtime (androidx.databinding:databinding-runtime:7.0.4) and jetified-library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11) 

Duplicate class androidx.databinding.Bindable found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.BindingAdapter found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.BindingBuildInfo found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.BindingConversion found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.BindingMethod found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.BindingMethods found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.CallbackRegistry found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.CallbackRegistry$NotifierCallback found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.DataBinderMapper found in modules databinding-runtime-7.0.4-runtime (androidx.databinding:databinding-runtime:7.0.4) and jetified-library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11) Duplicate class androidx.databinding.DataBindingUtil found in modules databinding-runtime-7.0.4-runtime (androidx.databinding:databinding-runtime:7.0.4) and jetified-library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11) Duplicate class androidx.databinding.InverseBindingAdapter found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.InverseBindingListener found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.InverseBindingMethod found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) Duplicate class androidx.databinding.InverseBindingMethods found in modules databinding-common-7.0.4 (androidx.databinding:databinding-common:7.0.4) and jetified-baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11)....

Go to the documentation to learn how to Fix dependency resolution errors.

Here is the Cradle(module) file:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
compileSdk 31

defaultConfig {
     applicationId "com.example.singupactivity"
     minSdk 24
     targetSdk 31
     versionCode 1
     versionName "1.0"

     testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 }



  buildTypes {
        release {
          minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 
           'proguard-rules.pro'
    }
  }
  compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  kotlinOptions {
     jvmTarget = '1.8'
  }
   buildFeatures {
     //noinspection DataBindingWithoutKapt
     dataBinding true
  }
}

apply plugin: 'kotlin-kapt'


dependencies {

  implementation "com.github.moxy-community:moxy:2.2.2"
  kapt "com.github.moxy-community:moxy-compiler:2.2.2"

  implementation "androidx.recyclerview:recyclerview:1.3.0-alpha01"
  implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
  implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0-rc01'
  implementation 'androidx.navigation:navigation-ui-ktx:2.4.0-rc01'
  implementation 'com.makeramen:roundedimageview:2.3.0'
  implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
  implementation 'com.squareup.retrofit2:retrofit:2.3.0'
  implementation 'com.squareup.retrofit2:retrofit:2.3.0'
  implementation 'androidx.core:core-ktx:1.7.0'
  implementation 'androidx.appcompat:appcompat:1.4.1'
  implementation 'com.google.android.material:material:1.5.0'
  implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
  implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
  implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
  implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  implementation 'androidx.test:core-ktx:1.4.0'
  implementation 'androidx.databinding:library:3.2.0-alpha11'
  testImplementation 'junit:junit:'
  androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

Here is the Cradle(project) file:

     // Top-level build file where you can add configuration options common to all sub- 
 projects/modules.
buildscript {
  repositories {
      google()
      mavenCentral()
 }
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'

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

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

There are 1 answers

0
p.santhosh On

first step --go to gradle.properties and check whether android.enableJetifier is false and implement the code in build.gradle(Module)

implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'