简体   繁体   中英

module classpath for missing or conflicting dependencies for BViewBinding

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:

在此处输入图片说明

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
    }
}

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM