debug/dataBindingGenBaseClassesDebug/databinding/ActivitySignupBinding.java AndroidX Databiing not working Android Studio Cannot find Symbol

与世无争的帅哥 提交于 2019-12-08 09:18:15

问题


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

i tried changed the version of GRadle and updating the project i ended up with this error the below image shows the package not found image1 but the Signup Package is available image2

request Assistance thanks in advance (caught in this issue realy hard)


回答1:


For some weird reason (the databinding algorithm is programmed to detect names starting with uppercase as class names and correspondingly names the binding object with them), package names starting with capital letters cause errors with databinding.

I also had a similar issue that cost me several hours of debugging.

I eventually figured out you just need to change the package names to start with a SMALL (LOWER CASE) LETTER AND NOT CAPITAL (UPPER CASE).

Refactor package Splash to splash, Signup to signup, and do the same for other packages starting with a capital letter, clean then rebuild your project. If still doesn't work, invalidate android studio caches and restart your computer




回答2:


it's not about data binding, sometimes when doing a bad field initializing in model it happened.

go to messages of logcat and watch there.

before it clean and rebuild project

update me in comments

it's a common problem in realm models but you don't use it and i will help you solve this issue.



来源:https://stackoverflow.com/questions/58915112/debug-databindinggenbaseclassesdebug-databinding-activitysignupbinding-java-andr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!