gpt4 book ai didi

android - 无法访问 'androidx.activity.result.ActivityResultCaller'

转载 作者:行者123 更新时间:2023-12-03 13:26:19 24 4
gpt4 key购买 nike

我正在使用 安卓x 很长一段时间,我的 Android 项目编译得很好,但是最近我的 Android Studio 为所有 Activity 类抛出了大量的红色

enter image description here因为
cannot access 'androidx.activity.result.ActivityResultCaller' which is a supertype of ...
我用

AppCompatActivity 来自 androidx.appcompat:appcompat:1.1.0
我的 build.gradle 有:

    ext.kotlin_version = '1.3.71'
...
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'

毕业版本 distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
我的 gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx4608m
org.gradle.parallel=true

# Use kapt in parallel
kapt.use.worker.api=true

# Kapt compile avoidance
kapt.include.compile.classpath=false

最佳答案

这是因为 Gradle 在解析升级的依赖库版本时发生的 androidx.core:core到 1.2.0 以上的版本,可能到 1.3.0-beta01 或 1.3.0-rc01
AppCompatActivity扩展 FragmentActivity扩展 ComponentActivity扩展 androidx.core.app.ComponentActivity实现 ActivityResultCaller介绍于 androidx.activity:activity:1.2.0-alpha03只要。

要解决此问题,请将此依赖项添加到您的 模块 build.gradle :

dependencies {
implementation "androidx.activity:activity-ktx:1.2.0-alpha03"
}

关于android - 无法访问 'androidx.activity.result.ActivityResultCaller',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61381545/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com