Android Studio Arctic Fox 載入 AAR錯誤訊息: Build was configured to prefer settings repositories over project repositories but repository 'flatDir' was added by build file 'app/build.gradle')
想要導入AAR檔案做為Library使用時,在之前Android Studio Arctic Fox之前的版本,有一項必備的步驟是在app/build.gradle加入了下列的語法,讓libs目錄做為存放library的目錄
repositories {
flatDir {
dirs 'libs'
}
}
但是如果是在Arctic Fox的版本,卻會發生以下的錯誤訊息:
A problem occurred evaluating project ':app'.
> Build was configured to prefer settings repositories over project repositories but repository 'flatDir' was added by build file 'app/build.gradle'
1. 刪除本來的語法
repositories {
flatDir {
dirs 'libs'
}
}
2. dependencies加上
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
參考資料:
留言
張貼留言