報(bào)錯(cuò)日志:
Unable to resolve dependency for ':app@betaUnitTest/compileClasspath': Could not resolve project :ptr.
Could not resolve project :ptr.
Required by:
project :app
Unable to find a matching configuration of project :ptr:
解決方案:
分析了錯(cuò)誤日志,和BuildType有關(guān)苟弛,“beta”、“debug”。
導(dǎo)入的library項(xiàng)目名為ptr,build.gradle的:
buildTypes {
release {
....//我自己項(xiàng)目中的配置
}
}
App的build.gradle是這樣的:
buildTypes {
debug {
....//我自己項(xiàng)目中的配置
}
beta {
....//我自己項(xiàng)目中的配置
}
release {
....//我自己項(xiàng)目中的配置
}
}
對(duì)比發(fā)現(xiàn)確實(shí)是少了這兩個(gè)驳糯,重新修改library的build.gradle痘拆,如下:
buildTypes {
debug {
...
}
beta {
...
//關(guān)鍵代碼,release除秀, debug為library中已有buildType
matchingFallbacks = ['release', 'debug']
}
release {
...
}
}
重新Build一下項(xiàng)目,就好了算利。