發表文章

目前顯示的是 十月, 2021的文章

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' ]) 參考資料: https://huayig.cn/index.php/archives/101/