首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在旧的android项目中添加数据绑定而添加新的活动?

如何在旧的android项目中添加数据绑定而添加新的活动?
EN

Stack Overflow用户
提问于 2022-05-18 02:13:08
回答 1查看 92关注 0票数 -1

在通过Android添加活动时获取数据库错误。如何解决此错误?

我正试图通过android工作室在我现有的项目中添加新的活动。那次我使用了targetSdkVersion 30 sdk。但是在更新targetSdkVersion 32之后,当尝试通过android添加New时,会得到这个错误,如图所示。

这是我的build.gradle

代码语言:javascript
复制
plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 32
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.softwares.bannari.whatstouch"
        minSdkVersion 21
        targetSdkVersion 32
        versionCode 47
        versionName "1.1.47"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    bundle {
        language {
            enableSplit = false
        }
    }
    buildFeatures {
        viewBinding true
    }

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.6.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
//    implementation project(path: ':nativetemplates')
    implementation 'com.google.firebase:firebase-analytics:21.0.0'
    implementation 'com.google.firebase:firebase-crashlytics:18.2.10'
    implementation 'androidx.navigation:navigation-fragment:2.4.2'
    implementation 'androidx.navigation:navigation-ui:2.4.2'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation group: 'commons-io', name: 'commons-io', version: '2.6'
    implementation 'the.bot.box:appusagemonitor:2.1.0'
    implementation 'com.github.bumptech.glide:glide:4.12.0'
//    implementation project(path: ':nativetemplates')
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'
    implementation 'com.github.natheeshsunway:Android-Permissions:2.0.5'
    implementation 'com.google.android.material:material:1.6.0'
    implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
    implementation 'org.jetbrains:annotations:16.0.1'
    implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.3.0'
    implementation 'com.rm:rmswitch:1.2.2'

    implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6"
    implementation "com.airbnb.android:lottie:3.5.0"

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation 'com.squareup.retrofit2:retrofit:2.7.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.okhttp3:okhttp:3.14.7'
    implementation "androidx.preference:preference:1.2.0"

    implementation 'com.google.android.gms:play-services-ads:19.7.0'
    implementation 'com.suddenh4x.ratingdialog:awesome-app-rating:2.2.1'
    implementation 'org.aviran.cookiebar2:cookiebar2:1.1.4'
    implementation 'eu.dkaratzas:android-inapp-update:1.0.5'
    implementation 'com.akexorcist:localization:1.2.6'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'

    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'


    def lifecycle_version = "2.0.0"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.4.1"

}
repositories {
    mavenCentral()
}

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-18 04:04:44

首先,删除ActivityGroupsActivityBinding,的第一行(导入的库)不要删除绑定类及其对象。然后单击ActivityGroupsActivityBinding类名,然后从左侧导入建议。或者您可以再次导入,方法是单击它然后按alt+enter

看看如何使用Android环境下的数据库化

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72282521

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档