Cannot access ‘androidx.lifecycle.HasDefaultViewModelProviderFactory‘ which is a supertype of ‘com.e

简介: 今天创建了个项目,突然出现了这样的问题,怎么处理都没用,网上找了一堆没发现答案,故此记录。

Cannot access ‘androidx.lifecycle.HasDefaultViewModelProviderFactory’ which is a supertype of ‘com.example.a19.MainActivity’. Check your module classpath for missing or conflicting dependencies


今天创建了个项目,突然出现了这样的问题,怎么处理都没用,网上找了一堆没发现答案,故此记录。

image.png

增加这个依赖到你的build即可解决。

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'


目录
相关文章
|
Android开发
android学习之——Gradle sync failed: Could not determine artifacts for xxxxx
android学习之——Gradle sync failed: Could not determine artifacts for xxxxx
android学习之——Gradle sync failed: Could not determine artifacts for xxxxx
|
3月前
|
开发工具 Android开发
解决Manifest merger failed : android:exported needs to be explicitly specified for <activity>
解决Manifest merger failed : android:exported needs to be explicitly specified for <activity>
77 1
|
5月前
|
Android开发
Android studio 出现Plugin [id: ‘com.android.application‘, version: ‘8.1.0‘, apply: false] 问题解决办法
Android studio 出现Plugin [id: ‘com.android.application‘, version: ‘8.1.0‘, apply: false] 问题解决办法
1198 1
|
Android开发
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
This project uses AndroidX dependencies, but the ‘android.useAndroidX‘ property is not enabled
This project uses AndroidX dependencies, but the ‘android.useAndroidX‘ property is not enabled
204 0
|
Android开发
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.C
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.C
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.C
|
Android开发
DSL element ‘android.dataBinding.enabled‘ is obsolete and has been replaced with ‘android.buildFeatu
DSL element ‘android.dataBinding.enabled‘ is obsolete and has been replaced with ‘android.buildFeatu
212 0
|
NoSQL Java Android开发
Remote Configuration for Android using Alibaba Cloud Table Store
In this tutorial, you will learn how to use Table Store to create a simple user information database with a form accessible on mobile devices.
1645 0
|
Android开发
simple Android EventBus code
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.
715 0