google / iosched

The Google I/O Android App
Apache License 2.0
21.78k stars 6.21k forks source link

error: cannot find symbol DataBindingComponent #280

Closed stanbar closed 6 years ago

stanbar commented 6 years ago

Hello. I'm wondering how did you solve the databinding error: cannot find symbol DataBindingComponent in your project. Since I migrated to Android Studio 3.2/androidx I can't solve this issue. Surprisingly I can easly build mobile module from your project. I tried to copy your build.gradle files, but It doesn't help. The only difference that may cause the issue is that I have productFlavors and multiDex I know that it may not be the place for this kind of issues, but the answers from SOF Cannot find symbol DataBindingComponent on Android Studio 3.2 Canary 16 Kotlin project error: cannot find symbol class DataBindingComponent Cannot find symbol DataBindingComponent on Android Studio 3.3 Canary 3 Kotlin project Suggesting to remove explicit dependency kapt "androidx.databinding:databinding-compiler:3.2.0-beta05" doesn't work, since I don't have any.

Here are my gradle files.

buildscript {
    ext {
        // SDK and tools
        compileSdkVersion = 28
        minSdkVersion = 21
        minTvSdkVersion = 21 // TV was introduced with Lollipop, min SDK should be 21.
        targetSdkVersion = 28

        // App dependencies
        androidGradlePluginVersion = '3.2.0-beta04'
        appcompatVersion = '1.0.0-beta01'
        browserVersion = '1.0.0-beta01'
        constraintLayoutVersion = '1.1.2'
        crashlyticsVersion = '2.9.4'
        dagger = "2.16"
        espressoVersion = '3.1.0-alpha1'
        fabricVersion = '1.25.4'
        firebaseAuthVersion = '16.0.2'
        firebaseConfigVersion = '16.0.0'
        firebaseCoreVersion = '16.0.1'
        firebaseFirestoreVersion = '17.0.3'
        firebaseMessagingVersion = '17.1.0'
        firebaseUiVersion = "3.3.1"
        flexboxVersion = "0.3.2"
        glideVersion = "4.6.1"
        googleMapUtilsVersion = "0.5"
        googlePlayServicesMapsVersion = '15.0.1'
        googleServicesVersion = "3.2.0"
        gsonVersion = "2.8.1"
        hamcrestVersion = '1.3'
        junitVersion = '4.12'
        kotlinVersion = '1.2.60'
        ktxVersion = "1.0.0-beta01"
        leakCanaryVersion = "1.5.4"
        leanbackVersion = '1.0.0-beta01'
        legacySupportVersion = '1.0.0-alpha1'
        lifecycleVersion = '2.0.0-beta01'
        lottieVersion = "2.5.1"
        materialVersion = '1.0.0-beta01'
        mockitoVersion = "2.8.9"
        mockitoKotlinVersion = "1.5.0"
        okhttpVersion = "3.10.0"
        pageIndicatorVersion = "1.3.0"
        rulesVersion = '1.1.0-alpha1'
        runnerVersion = '1.1.0-alpha1'
        threetenabpVersion = "1.0.5"
        threetenbpVersion = "1.3.6"
        timberVersion = "4.7.0"
        tvproviderVersion = '1.0.0-beta01'
    }

    repositories {
        google()
        mavenCentral()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath "com.google.gms:google-services:$googleServicesVersion"
        classpath "io.fabric.tools:gradle:$fabricVersion"
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
        maven { url "http://dl.bintray.com/jjhesk/maven" }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.stasbar"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode 352
        versionName "13.08.2018-2"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    dataBinding {
        enabled = true
    }
    signingConfigs {
        ...
    }
    buildTypes {
        debug {
            ext.enableCrashlytics = false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    lintOptions {
        disable 'MissingTranslation'
        disable 'ExtraTranslation'
        disable 'InvalidPackage'
    }
    flavorDimensions "model", "stage"
    productFlavors {
        dev {
            dimension "stage"
            minSdkVersion 27
            resConfigs "en", "xxhdpi"
        }
        prod {
            dimension "stage"
        }
        pro {
            applicationIdSuffix ".vapetoolpro"
            versionNameSuffix "-pro"
            signingConfig signingConfigs.prorelease
            dimension "model"
        }
        free {
            applicationIdSuffix ".vape_tool"
            versionNameSuffix "-free"
            signingConfig signingConfigs.freerelease
            dimension "model"
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

ext {
    anko_version = "0.10.5"
    koin_version = "1.0.0-beta-3"
    firebaseUi = "4.1.0"
    work_version = "1.0.0-alpha06"
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(path: ':lvl')

    /** Kotlin */
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.23.4'

    /** Android Support */
    implementation "androidx.appcompat:appcompat:$appcompatVersion"
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'androidx.core:core:1.0.0-beta01'
    implementation 'androidx.annotation:annotation:1.0.0-beta01'
    implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
    implementation 'androidx.preference:preference:1.0.0-beta01'
    implementation 'androidx.cardview:cardview:1.0.0-beta01'
    implementation 'androidx.palette:palette:1.0.0-beta01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
    implementation 'androidx.percentlayout:percentlayout:1.0.0-beta01'
    implementation "com.google.android.material:material:$materialVersion"
    implementation "androidx.browser:browser:$browserVersion"
    implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"

    /** FirebaseUI */
    implementation "com.firebaseui:firebase-ui-database:$firebaseUi"
    implementation "com.firebaseui:firebase-ui-auth:$firebaseUi"
    implementation "com.firebaseui:firebase-ui-storage:$firebaseUi"

    /** Firebase */
    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'

    // Required only if Facebook login support is required
    implementation 'com.facebook.android:facebook-login:4.31.0'

    /** Anko */
    implementation "org.jetbrains.anko:anko-commons:$anko_version"
    implementation "org.jetbrains.anko:anko-sdk25:$anko_version"
    implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
    implementation "org.jetbrains.anko:anko-coroutines:$anko_version"

    /** Coroutine listeners for Anko Layouts */
    implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
    implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"

    /** DI */
    implementation "org.koin:koin-android:$koin_version"
    implementation "org.koin:koin-androidx-scope:$koin_version"
    implementation "org.koin:koin-androidx-viewmodel:$koin_version"

    /** Arch */
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
    kapt "androidx.lifecycle:lifecycle-compiler:$lifecycleVersion"
    testImplementation "androidx.arch.core:core-testing:$lifecycleVersion"
    implementation "android.arch.work:work-runtime-ktx:$work_version"

    /** Leak Canary **/
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

    /** QR Code **/
    implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    implementation 'com.google.zxing:core:3.3.2'

    /** Rx */
    implementation 'com.github.tbruyelle:rxpermissions:0.10.2'
    implementation 'com.github.VictorAlbertos:RxActivityResult:0.4.5-2.x'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.16'

    /** Glide */
    implementation "com.github.bumptech.glide:glide:$glideVersion"
    annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"

    /** Misc */
    implementation 'com.chibatching.kotpref:kotpref:2.5.0'
    implementation 'com.hendraanggrian.appcompat:socialview:0.1'
    implementation 'com.hendraanggrian.appcompat:socialview-commons:0.1'
    implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
    implementation 'com.github.stasbar:android-prompter:3.0.0'
    implementation 'com.github.wrdlbrnft:sorted-list-adapter:0.3.0.27'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'pub.devrel:easypermissions:1.0.1'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.daimajia.easing:library:2.0@aar'
    implementation 'com.daimajia.androidanimations:library:2.2@aar'
    implementation 'com.github.ShogoMizumoto:ZDepthShadowLayout:1.0.4'
    implementation 'com.github.apl-devs:appintro:v4.2.3'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.minimize.library:seekbar-compat:0.2.5'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
    implementation 'mobi.upod:time-duration-picker:1.1.3'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.github.linger1216:labelview:v1.1.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.0.1'
    implementation 'com.akexorcist:localizationactivity:1.2.2'

    /** Tests */
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-inline:2.19.0'
    testImplementation 'org.hamcrest:hamcrest-all:1.3'
    testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1'
    testImplementation 'org.amshove.kluent:kluent-android:1.40'

    // Android Tests
    androidTestImplementation 'org.mockito:mockito-inline:2.19.0'
    androidTestImplementation('androidx.test:runner:1.1.0-alpha4') {
        exclude group: "com.android.support"
    }
    androidTestImplementation('androidx.test:rules:1.1.0-alpha4') {
        exclude group: "com.android.support", module: "support-annotations"
    }
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4') {
        exclude group: "com.android.support", module: "support-annotations"
    }
}
apply plugin: 'com.google.gms.google-services'
kotlin {
    experimental {
        coroutines "enable"
    }
}

gradle.properties

org.gradle.jvmargs=-Xmx2g
org.gradle.caching=false # TODO: change to true when build problems are solved.
# AndroidX
android.useAndroidX=true
android.enableJetifier=true

gradle.wrapper

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
> Task :app:kaptGenerateStubsProProdDebugKotlin
e: /Users/stasbar/Projects/AndroidProjects/VapeToolPro/app/build/generated/data_binding_base_class_source_out/proProdDebug/dataBindingGenBaseClassesProProdDebug/out/com/stasbar/databinding/FragmentPowerDialogBinding.java:38: error: cannot find symbol
  protected FragmentPowerDialogBinding(DataBindingComponent _bindingComponent, View _root,
                                       ^
  symbol:   class DataBindingComponent
  location: class FragmentPowerDialogBinding
Edijae commented 6 years ago

@stasbar Did you find a solution to this error?

stanbar commented 6 years ago

@Edijae Partly, because I solved the issue, but I'm not sure what was the cause. What I did is, manually fixing all the files that has problems because of Migration to AndroidX (wrong imports, wrong packages in XMLs etc.). Additionally, I needed to update Glide from 4.7 to 4.8. When I fixed all red files the problem disappeared.

Edijae commented 6 years ago

@stasbar I managed to solve the error by adding the below two lines of codes in my project's gradle.properties file

android.useAndroidX=true
android.enableJetifier=true

After that, I faced another error in my case which I also managed to solve. see the error and the solution at https://stackoverflow.com/q/52002186/3671509

stanbar commented 6 years ago

@Edijae those properties was successfully added by Migrate to AndroidX so that wasn't issue in my case

Edijae commented 6 years ago

@stasbar Yes. but their default values are false

stanbar commented 6 years ago

"Migrate to AndroidX" set them to true.

gs-ts commented 5 years ago

hi @stasbar ! Did you migrate the iosched project to Kotlin? If yes is it on GitHub, because I can't find it!

zumrycms commented 5 years ago

Remove unnecessary imports from Gradle, I had to remove Room Compiler from Gradle,

check my answer here - https://stackoverflow.com/a/55722208/1348522