AndroidStudio3.1.2依赖Module不显示解决方法

本文介绍了解决Android项目中Module依赖库导入失败的方法。通过调整settings.gradle和build.gradle文件中的配置,包括修改dependencies从implementation到api,以及更新库版本等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言:
在项目中用到了一个依赖库我使用的是Module导入,进行关联时发现找不到此依赖库,折腾了半天终于解决了,特此记录一下。
下面是我的解决方案在settings.gradle中include ':app'这一行后面加上你依赖库的名字如:include ':app', ':banner'然后再到你的build.gradle中把dependencies中的implementation修改为api

dependencies {
    api  fileTree(include: ['*.jar'], dir: 'libs')
    api  'com.android.support:appcompat-v7:27.1.1'
    api  'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    api  'com.android.support:recyclerview-v7:27.1.1'
    api  'com.alibaba:fastjson:1.1.68.android'
    api  'com.github.bumptech.glide:glide:3.7.0'
}

接着再到你依赖的库中把build.gradle中dependencies 部分修改一下如:compile修改为api ,testCompile修改为testImplementation

dependencies {
    api  fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation  'junit:junit:4.12'
    api  'com.android.support:appcompat-v7:23.4.0'
    api  'com.github.bumptech.glide:glide:3.6.1'
}

最后把依赖库中的buildToolsVersion “23.0.3”版本修改成buildToolsVersion “27.0.3”,因为AndroidStudio3.1.2版本最低支持27.0.3.。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值