supertypes of the following classes cannot be resolved. make sure you have the required dependencies


       

1、问题

  • Android Studio 编译报错: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath : class X, unresolved supertypes: Y
  • 重启且清除Android Studio缓存没用,clean后重新build也没用。

       

2、出现这个问题的原因

        咱翻译一下Android Studio 的这个报错信息: 下列类的父类找不到,请确保添加了必要的依赖:类X,未找到的父类Y。
       

为什么找不到类X的父类Y呢?下面举例说明,参考下图:

  • 假设现在有3个module,module A、module B 和 moduleC。
  • 你在module B里定义了类X,在moduleC里定义了类Y,类X的父类是Y,所以你在module B的build.gradle里写上了implementation “moduleC”,这样module B就依赖上了moduleC。
  • 你在module A里想使用类X,所以你在module A的build.gradle里写上了implementation “module B”,这样module A就依赖上了moduleB
  • 现在编译报错了,在module A中,找不到类X的父类Y

       

下面说说implementation 和 api的区

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值