1、方法一:在app的build.gradle中明确指定
android{ repositories { flatDir { dirs 'libs' } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation (name: 'barcode_scanner_library_v2.3.2.0', ext: 'aar') }
2、方法二:
android{ //不用写 /* repositories { flatDir { dirs 'libs' } }*/ } dependencies { 将 implementation fileTree(dir: 'libs', include: ['*.jar']) 改为 implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) }