react native 无法使用support v4包api

版本:

 "react": "16.8.6",
 "react-native": "0.59.8",

这个ActivityCompat是属于v4包下的api,但是RN项目却无法调用,使用多种办法依然无法解决,包括在对应项目的gradle添加依赖

implementation 'com.android.support:support-v4:28.0.0'

依赖无效,不知道怎么回事~~最终把jar包下载过来,添加lib的依赖才解决了问题

androidstudio添加依赖后会在这个目录缓存对应资源文件

C:\Users\xxx\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\b45efbe48115f5396321f36453b90e70

只需要在上图所示的jars目录里面把jar包添加至libs目录下,然后添加依赖即可

虽然api能调用了,但是会产生新的错误

> Android resource linking failed
  error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.companyloans:style/Theme.AppCompat.Light.NoActionBar) not found.
  error: resource style/Theme.AppCompat.Light.Dialog (aka com.companyloans:style/Theme.AppCompat.Light.Dialog) not found.
  error: resource style/TextAppearance.Compat.Notification.Info (aka com.companyloans:style/TextAppearance.Compat.Notification.Info) not found.
  error: resource style/TextAppearance.Compat.Notification (aka com.companyloans:style/TextAppearance.Compat.Notification) not found.
  error: resource style/TextAppearance.Compat.Notification.Time (aka com.companyloans:style/TextAppearance.Compat.Notification.Time) not found.
  error: resource style/TextAppearance.Compat.Notification.Title (aka com.companyloans:style/TextAppearance.Compat.Notification.Title) not found.
  C:\Users\PJ-3\.gradle\caches\transforms-1\files-1.1\coordinatorlayout-28.0.0.aar\8a4a6226525cb71f1d4262e87ff047b3\res\values\values.xml: AAPT: error: style attribute 'attr/windowActionBar (aka com.companyloans:attr/windowAct
ionBar)' not found.

  error: failed linking references.

就是找不到资源,添加如下依赖解决这个错误

implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值