我在用着androidx很长一段时间以来,我的 Android 项目编译得很好,但是最近我的 Android Studio 为所有 Activity 类抛出大量红色
because of
cannot access 'androidx.activity.result.ActivityResultCaller' which is a supertype of ...
I use
应用程序兼容性活动 from androidx.appcompat:appcompat:1.1.0
My 构建.gradle has:
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'
And 梯度版本
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
My 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
only.
要解决此问题,请将此依赖项添加到您的module build.gradle
:
dependencies {
implementation "androidx.activity:activity-ktx:1.2.0-alpha03"
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)