未解决的参考:在常规局部核能中进行数据指标

发布于 2025-02-03 07:48:10 字数 6532 浏览 3 评论 0原文

我正在开发一个常规的远程和本地应用程序,该应用程序从网络中捕获数据并将其保留到本地数据库中,并且在删除AndroIdeXtensions插件时,数据框后,数据指标开始失败。

我遇到的错误如下:

 Unresolved reference: databinding

的build.gradle文件如下:

build.gradle.app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-parcelize'


android {
    compileSdkVersion 31
    buildToolsVersion "30.0.3"

    defaultConfig {

        applicationId "com.example.petfinder"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        buildConfigField("String", "UNSPLASH_ACCESS_KEY", unsplash_access_key)
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

   buildFeatures{
       dataBinding true
   }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
}

dependencies {


    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //Fragment - kotlin
    implementation 'androidx.fragment:fragment-ktx:1.1.0'

    // Navigation Component
    implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
    implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"

    //Serializable

    implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
    //ViewModel
    // ViewModel
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    // LiveData
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
    implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycleVersion")
    // Dagger Hilt
    implementation "com.google.dagger:hilt-android:$hiltVersion"
    kapt "com.google.dagger:hilt-android-compiler:$hiltVersion"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hiltAndroidXVersion"
    kapt "androidx.hilt:hilt-compiler:$hiltAndroidXVersion"

    // Retrofit + GSON
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"

    // Glide
    implementation "com.github.bumptech.glide:glide:$glideVersion"
    kapt "com.github.bumptech.glide:compiler:$glideVersion"
    // Paging 3
    implementation "androidx.paging:paging-runtime:$pagingVersion"

    //Room
    def room_version = "2.4.0-alpha03"

    implementation("androidx.room:room-runtime:$room_version")

    // To use Kotlin annotation processing tool (kapt)
    kapt("androidx.room:room-compiler:$room_version")

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation("androidx.room:room-ktx:$room_version")

    // optional - RxJava2 support for Room
    implementation "androidx.room:room-rxjava2:$room_version"

    // optional - RxJava3 support for Room
    implementation "androidx.room:room-rxjava3:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"

    // optional - Test helpers
    //testImplementation("androidx.room:room-testing:$room_version")

    // optional - Paging 3 Integration
    //implementation("androidx.room:room-paging:$room_version")

    //multyindexing
    implementation 'androidx.multidex:multidex:2.0.1'

    //Firebase
    implementation platform('com.google.firebase:firebase-bom:28.4.1')

    implementation 'com.google.firebase:firebase-auth-ktx'
}

build.gradle.proyect

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        kotlinVersion = '1.4.20'
        navigationVersion = '2.3.0-alpha01'
        hiltVersion = '2.28.3-alpha'
        lifecycleVersion =  '2.4.0-rc01'
    }
    repositories {
        google()
        jcenter()
        maven { url "https://kotlin.bintray.com/kotlinx" }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath 'com.google.gms:google-services:4.3.10'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            // For Room Persistence Library
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

// Define versions in a single place
ext {
    // Sdk and tools
    minSdkVersion = 21
    targetSdkVersion = 29
    compileSdkVersion = 29

    // App dependencies
    appCompatVersion = '1.2.0'
    constraintLayoutVersion = '1.1.3'
    espressoVersion = '3.2.0'
    glideVersion = '4.11.0'
    hiltAndroidXVersion = '1.0.0-alpha02'
    junitVersion = '4.13'
    ktxVersion = '1.3.1'
    pagingVersion = '3.0.0-alpha05'
    retrofitVersion = '2.9.0'
    testExtJunitVersion = '1.1.1'
}


i还添加了以下内容。

android.databinding.enableV2=true

重新构建我 并重建Proyect,但仍会出现相同的尚未解决数据指标错误。

希望您能在这个常规问题上提供帮助。

提前致谢 !

I was developing a regular remote and local App which capture data from network and keep into a local database, and after uptade to kotlin version 1.4.20, databinding start to fail when I remove androidExtensions plugin.

The error I'm getting is the following:

 Unresolved reference: databinding

Regading my build.gradle file are the following:

build.gradle.app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-parcelize'


android {
    compileSdkVersion 31
    buildToolsVersion "30.0.3"

    defaultConfig {

        applicationId "com.example.petfinder"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        buildConfigField("String", "UNSPLASH_ACCESS_KEY", unsplash_access_key)
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

   buildFeatures{
       dataBinding true
   }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
}

dependencies {


    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //Fragment - kotlin
    implementation 'androidx.fragment:fragment-ktx:1.1.0'

    // Navigation Component
    implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
    implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"

    //Serializable

    implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
    //ViewModel
    // ViewModel
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    // LiveData
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
    implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycleVersion")
    // Dagger Hilt
    implementation "com.google.dagger:hilt-android:$hiltVersion"
    kapt "com.google.dagger:hilt-android-compiler:$hiltVersion"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hiltAndroidXVersion"
    kapt "androidx.hilt:hilt-compiler:$hiltAndroidXVersion"

    // Retrofit + GSON
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"

    // Glide
    implementation "com.github.bumptech.glide:glide:$glideVersion"
    kapt "com.github.bumptech.glide:compiler:$glideVersion"
    // Paging 3
    implementation "androidx.paging:paging-runtime:$pagingVersion"

    //Room
    def room_version = "2.4.0-alpha03"

    implementation("androidx.room:room-runtime:$room_version")

    // To use Kotlin annotation processing tool (kapt)
    kapt("androidx.room:room-compiler:$room_version")

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation("androidx.room:room-ktx:$room_version")

    // optional - RxJava2 support for Room
    implementation "androidx.room:room-rxjava2:$room_version"

    // optional - RxJava3 support for Room
    implementation "androidx.room:room-rxjava3:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"

    // optional - Test helpers
    //testImplementation("androidx.room:room-testing:$room_version")

    // optional - Paging 3 Integration
    //implementation("androidx.room:room-paging:$room_version")

    //multyindexing
    implementation 'androidx.multidex:multidex:2.0.1'

    //Firebase
    implementation platform('com.google.firebase:firebase-bom:28.4.1')

    implementation 'com.google.firebase:firebase-auth-ktx'
}

build.gradle.proyect

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        kotlinVersion = '1.4.20'
        navigationVersion = '2.3.0-alpha01'
        hiltVersion = '2.28.3-alpha'
        lifecycleVersion =  '2.4.0-rc01'
    }
    repositories {
        google()
        jcenter()
        maven { url "https://kotlin.bintray.com/kotlinx" }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath 'com.google.gms:google-services:4.3.10'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            // For Room Persistence Library
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

// Define versions in a single place
ext {
    // Sdk and tools
    minSdkVersion = 21
    targetSdkVersion = 29
    compileSdkVersion = 29

    // App dependencies
    appCompatVersion = '1.2.0'
    constraintLayoutVersion = '1.1.3'
    espressoVersion = '3.2.0'
    glideVersion = '4.11.0'
    hiltAndroidXVersion = '1.0.0-alpha02'
    junitVersion = '4.13'
    ktxVersion = '1.3.1'
    pagingVersion = '3.0.0-alpha05'
    retrofitVersion = '2.9.0'
    testExtJunitVersion = '1.1.1'
}


I also added the following in the gradle.properties file:

android.databinding.enableV2=true

After all change, I try o clean and rebuild proyect but still rise the same unresolve databinding error.

I hope you can help, in this regular issue.

Thanks in advance !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文