Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

module classpath for missing or conflicting dependencies for BViewBinding

Tags:

I am trying to enable View Binding on a project and I have this error:

Cannot access 'no_name_in_PSI_3d19d79d_1ba9_4cd0_b7f5_b46aa3cd5d40' which is a supertype of 'com.kevinabrioux.ping.databinding.ActivityStartingBinding'. Check your module classpath for missing or conflicting dependencies

This is where my error appear:

enter image description here

I have activate viewbinding in my gradle:

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.kevinabrioux.ping"
        minSdkVersion 29
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    buildFeatures {
        viewBinding = true
    }
}
like image 408
Kevin ABRIOUX Avatar asked Oct 09 '20 09:10

Kevin ABRIOUX


1 Answers

In my case this was happening because I had pasted in the <layout> tag in my XML and I wasn't using databinding.

Removing the <layout> tag fixed the problem.

<?xml version="1.0" encoding="utf-8"?>
<!-- Remove this layout tag and make LinearLayout the root -->
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".viewPresenter.webBrowser.WebBrowserFragment">
        .
        .
        .
    </LinearLayout>
</layout>
like image 51
Sufian Avatar answered Sep 30 '22 13:09

Sufian