1:?jiǎn)栴}描述
在module中依賴aar后,運(yùn)行會(huì)報(bào)app找不到module所依賴的aar包岳掐,如:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find :alipaysdk-15.8.03.210428205839:.
Required by:
project :app > project :lib_share
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
2:?jiǎn)栴}修復(fù)方案:
方案一:
在所有需要依賴此module的build.gradle 文件中添加此配置:
repositories {
flatDir {
dirs '../lib_share/libs'
}
}
若是module很多的話,此方法需要在每個(gè)module中配置下
方案二:
在項(xiàng)目根目錄中的build.gradle中添加此配置:
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
mavenCentral()
google()
jcenter()
// flatDir {
// dirs project(':lib_share').file("libs")
// }
}
}
省了很多事