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

前言:
在项目中用到了一个依赖库我使用的是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.。

猜你喜欢

转载自blog.csdn.net/SandyRan/article/details/80774076