我创建了一个android应用程序,并希望将其作为模块添加到其他应用程序中。我尝试使用以下文件导入应用程序:File-> New-> Import Module->(要导入的浏览应用程序)->(更改模块名称)-> Finish
导入应用程序后,发生了以下变化:
setting.gradle
import ':app'
import ':ocr'
build.gradle(Module:app)
implementation project(path: ':ocr')
该模块已添加到项目中。
但是当我尝试同步项目时,它显示以下错误:
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :ocr.
ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :ocr.
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :ocr.
ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :ocr.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :ocr.
我试图搜索所有问题,但无法解决。谁能说出问题出在哪里或如何解决?
答案 0 :(得分:0)
解决方案:
如official migration guide中所述,在以下情况下会遇到此错误:
您的应用程序包含库依赖项不包含的构建类型
android {
buildTypes {
release {
...
}
dexOptions {
...
// release & debug is in project ocr
matchingFallbacks = ['release', 'debug']
}
debug {
...
}
}
}