Android 工作室数据绑定错误,找不到符号:debug/dataBindingGenBaseClassesDebug/databinding/ActivitySignupBinding。java

Android studio databinding error, Cannot find symbol: debug/dataBindingGenBaseClassesDebug/databinding/ActivitySignupBinding.java

project/build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://maven.google.com' }
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    // Sdk and tools
    minSdkVersion = 16
    targetSdkVersion = 26
    compileSdkVersion = 26
    buildToolsVersion = '26.0.0'

    // App dependencies
    supportLibraryVersion = '25.4.0'
    gsonVersion = '2.8.0'
    calligraphyVersion = '2.2.0'
    glideVersion = '3.7.0'
    roomDatabase = '1.0.0-alpha3'
    rx2FastAndroidNetworking = '1.0.0'

    dagger2Version = '2.11'
    rxjava2Version = '2.0.6'
    rxandroidVersion = '2.0.1'
    placeholderviewVersion = '0.6.1'
    debugDBVersion = '1.0.0'
    timberVersion = '4.5.1'
    lifecycle = '1.0.0-alpha3'

    retrofitVersion='2.3.0'
    GsonVersion='2.7'
    okhttpVersion= '3.8.0'
    googleplus= '11.0.4'
    glideversion= '4.1.1'
    braintree='3.+'
    //Test dependencies
    junitVersion = '4.12'
    espressoVersion = '2.2.2'
    mockitoVersion = '2.7.1'
}
app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven {
        url 'https://maven.fabric.io/public'
    }
}
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
android {
    compileSdkVersion 28
    signingConfigs {
        ReleaseConfig {
            keyAlias 'test'
            keyPassword 'test'
            storeFile file('../KeyStore/test.jks')
            storePassword 'test'
        }
    }
    defaultConfig {
        applicationId "bz.pie.rider"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 2
        multiDexEnabled true
        versionName "1.1"
        vectorDrawables.useSupportLibrary = true
        signingConfig signingConfigs.ReleaseConfig
        setProperty("archivesBaseName", "PEITaxi_User_v$versionName")
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }

    dataBinding.enabled = true
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':countrylist')
//    implementation project(':slideDateTimePicker')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    // dependency injection
    implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
    implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion"
    implementation 'com.github.javiersantos:AppUpdater:2.7'
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    implementation "com.google.android.gms:play-services-auth:$rootProject.googleplus"
    implementation "com.github.bumptech.glide:glide:$rootProject.glideversion"
    implementation('io.socket:socket.io-client:1.0.0') {
        exclude group: 'org.json', module: 'json'
    }
    implementation "com.braintreepayments.api:drop-in:$rootProject.braintree"
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.4'
    implementation 'com.facebook.android:facebook-login:[4,5)'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-identity:16.0.0'
    implementation 'com.google.android.gms:play-services-plus:16.0.0'
    implementation 'com.google.android.gms:play-services-drive:16.1.0'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-places:16.1.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'androidx.multidex:multidex:2.0.0'

    testImplementation 'junit:junit:4.12'
    // Optional -- Robolectric environment
    testImplementation 'androidx.test:core:1.0.0'
    // Optional -- Mockito framework
    testImplementation 'org.mockito:mockito-core:1.10.19'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    // Required for instrumented tests
    androidTestImplementation 'androidx.annotation:annotation:1.0.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'

}
apply plugin: 'com.google.gms.google-services'
gradle.properties

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# Android X: https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.enableJetifier=true
android.databinding.enableV2=true
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

wrapper.properties

#Mon Nov 18 11:40:24 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

我尝试更改 GRadle 的版本并更新项目,但我最终遇到了这个错误 下图显示找不到包裹 image1 但注册包可用 image2

提前请求帮助(陷入这个问题真的很难)

这与数据绑定无关,有时在模型中进行错误的字段初始化时会发生这种情况。

转到 logcat 的消息并在那里观看。

清理和重建项目之前

在评论中更新我

realm模型的通病,你不会用,我来帮你解决。

由于某些奇怪的原因(数据绑定算法被编程为检测以大写字母开头的名称作为 class 名称并相应地用它们命名绑定对象),以大写字母开头的包名称会导致数据绑定错误。

我也遇到了类似的问题,调试了好几个小时。

我最终发现您只需要将包名称更改为以小写(小写)字母而非大写(大写)字母开头。

重构包 Splash 到 splash,Signup 到 signup,并对其他以大写字母开头的包执行相同的操作,清理然后重建您的项目。如果仍然无效,请使 android 工作室缓存无效并重新启动计算机